Cześć,

On Thursday, 12 December 2013 at 05:34, Tomasz Wasilczyk wrote:
> Ciężko to zdebugować, bo pthread miesza na stosie (użycie sigsetjmp).

Udało mi się znowu dość powtarzalnie wywołać ten błąd na Fedorze
19/i686 przy budowaniu paczki z 1.12.0-rc3.

> Czy przy kompilacji były jakiekolwiek błędy? Jakie flagi do configure użyłeś
> (zgaduję, że m.in. --with-pthread=yes).

Flagi configure:
./configure --build=i686-redhat-linux-gnu --host=i686-redhat-linux-gnu 
--program-prefix= --disable-dependency-tracking --prefix=/usr 
--exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc 
--datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib 
--libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/var/lib 
--mandir=/usr/share/man --infodir=/usr/share/info --disable-silent-rules 
--disable-static --without-openssl --with-pthread

Błędów kompilacji nie było. Wywołanie libtoola dla tego pliku wygląda tak:
/bin/sh ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I.. 
-I../include    -I.. -I../include -DGG_IGNORE_DEPRECATED -O2 -g -pipe -Wall 
-Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector 
--param=ssp-buffer-size=4 -grecord-gcc-switches  -m32 -march=i686 -mtune=atom 
-fasynchronous-unwind-tables -Wall -Wextra -Wmissing-prototypes             
-Wno-unused-parameter -Waggregate-return                
-Wdeclaration-after-statement -Wundef -Wcast-align              -Wpointer-arith 
 -I/usr/include/p11-kit-1   -c -o libgadu_la-resolver.lo `test -f 'resolver.c' 
|| echo './'`resolver.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -I../include -I.. -I../include 
-DGG_IGNORE_DEPRECATED -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions 
-fstack-protector --param=ssp-buffer-size=4 -grecord-gcc-switches -m32 
-march=i686 -mtune=atom -fasynchronous-unwind-tables -Wall -Wextra 
-Wmissing-prototypes -Wno-unused-parameter -Waggregate-return 
-Wdeclaration-after-statement -Wundef -Wcast-align -Wpointer-arith 
-I/usr/include/p11-kit-1 -c resolver.c  -fPIC -DPIC -o 
.libs/libgadu_la-resolver.o

> Możesz sprawdzić, czy te makra są
> zdefiniowane: __GNUC__, __EXCEPTIONS, __cplusplus (tuż przed includowaniem
> pthread.h w resolver.c).

__GNUC__ i __EXCEPTIONS są zdefiniowane, __cplusplus nie.

> Spróbuj zaaplikować łatkę z załącznika, rozwieje parę wątpliwości:
> - czy wątek jest zabijany w jakimś niespodziewanym momencie (patrz linijka
> pthread_setcancelstate i jej komentarz)
> - ile razy jest wywoływany gg_resolver_pthread_cleanup - zagnieżdżone
> pthread_cleanup_push nie powinny robić szkód, ale nigdy nie wiadomo

Łatka wprawdzie już się nie daje nałożyć, ale pomaga dodanie

pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);

w linii 535.

Bez tego mniej więcej co 3 wywołanie testu automatic/resolver kończy
się segmentation fault (załączam log z poprawnego i nieudanego wykonania
testu).

gdb pokazuje:
(gdb) run
Starting program: 
/builddir/build/BUILD/libgadu-1.12.0-rc3/test/automatic/./resolver 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/libthread_db.so.1".
*** TEST 1 ***

Setting global fork resolver
Setting global pthread resolver
Setting global custom resolver
Setting global default resolver
Testing local default resolver
** gg_login(0xffffd61c: [uin=1, async=1, ...]);
** gg_watch_fd(0x804c008);
// gg_watch_fd() GG_STATE_RESOLVE_HUB_ASYNC
** gg_resolver_pthread_start(0x804c008, 0x804c094, "appmsg.gadu-gadu.pl");
[New Thread 0xf7b0bb40 (LWP 3952)]
// gg_resolver_pthread_start() 0x804c1d8
** gg_event_free(0x804c198);
** gg_free_session(0x804c008);
** gg_resolver_pthread_cleanup(0x804c094 [0x804c1d8], 1);

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xf7b0bb40 (LWP 3952)]
0xf7fa7480 in free@plt () from 
/builddir/build/BUILD/libgadu-1.12.0-rc3/src/.libs/libgadu.so.3
(gdb) where
#0  0xf7fa7480 in free@plt () from 
/builddir/build/BUILD/libgadu-1.12.0-rc3/src/.libs/libgadu.so.3
#1  0xf7fc3e51 in gg_resolver_cleaner (data=0xf7b0b35c) at resolver.c:69
#2  __pthread_cleanup_routine (__frame=<synthetic pointer>) at 
/usr/include/pthread.h:602
#3  gg_resolver_run (fd=<optimized out>, hostname=<optimized out>, 
pthread=pthread@entry=1) at resolver.c:287
#4  0xf7fc3e86 in gg_resolver_pthread_thread (arg=0x804c1d8) at resolver.c:540
#5  0xf7e4e9da in start_thread () from /lib/libpthread.so.0
#6  0xf7d80bfe in clone () from /lib/libc.so.6

Pozdrawiam,
Dominik

-- 
Fedora http://fedoraproject.org/wiki/User:Rathann
RPMFusion http://rpmfusion.org | MPlayer http://mplayerhq.hu
"Faith manages."
        -- Delenn to Lennier in Babylon 5:"Confessions and Lamentations"
[mockbuild@amaterasu automatic]$ ./resolver 
*** TEST 1 ***

Setting global fork resolver
Setting global pthread resolver
Setting global custom resolver
Setting global default resolver
Testing local default resolver
** gg_login(0xffe0b23c: [uin=1, async=1, ...]);
** gg_watch_fd(0x8753008);
// gg_watch_fd() GG_STATE_RESOLVE_HUB_ASYNC
** gg_resolver_pthread_start(0x8753008, 0x8753094, "appmsg.gadu-gadu.pl");
// gg_resolver_pthread_start() 0x87531d8
** gg_event_free(0x8753198);
** gg_free_session(0x8753008);
** gg_resolver_pthread_cleanup(0x8753094 [0x87531d8], 1);
Testing global default fork
Testing local fork resolver
** gg_login(0xffe0b23c: [uin=1, async=1, ...]);
** gg_watch_fd(0x8753008);
// gg_watch_fd() GG_STATE_RESOLVE_HUB_ASYNC
** gg_resolver_fork_start(0x8753008, 0x8753094, "appmsg.gadu-gadu.pl");
// gg_resolver_fork_start() 0x8753188
** gg_event_free(0x8753198);
** gg_free_session(0x8753008);
Testing local pthread resolver
** gg_login(0xffe0b23c: [uin=1, async=1, ...]);
** gg_watch_fd(0x8753008);
// gg_watch_fd() GG_STATE_RESOLVE_HUB_ASYNC
** gg_resolver_pthread_start(0x8753008, 0x8753094, "appmsg.gadu-gadu.pl");
// gg_resolver_pthread_start() 0x87531d8
** gg_event_free(0x8753198);
** gg_free_session(0x8753008);
** gg_resolver_pthread_cleanup(0x8753094 [0x87531d8], 1);
Setting global fork resolver
Testing local default resolver
** gg_login(0xffe0b23c: [uin=1, async=1, ...]);
** gg_watch_fd(0x8753008);
// gg_watch_fd() GG_STATE_RESOLVE_HUB_ASYNC
** gg_resolver_fork_start(0x8753008, 0x8753094, "appmsg.gadu-gadu.pl");
// gg_resolver_fork_start() 0x8753188
** gg_event_free(0x8753198);
** gg_free_session(0x8753008);
Testing local fork resolver
** gg_login(0xffe0b23c: [uin=1, async=1, ...]);
** gg_watch_fd(0x8753008);
// gg_watch_fd() GG_STATE_RESOLVE_HUB_ASYNC
** gg_resolver_fork_start(0x8753008, 0x8753094, "appmsg.gadu-gadu.pl");
// gg_resolver_fork_start() 0x87531d8
** gg_event_free(0x8753198);
** gg_free_session(0x8753008);
Testing local pthread resolver
** gg_login(0xffe0b23c: [uin=1, async=1, ...]);
** gg_watch_fd(0x8753008);
// gg_watch_fd() GG_STATE_RESOLVE_HUB_ASYNC
** gg_resolver_pthread_start(0x8753008, 0x8753094, "appmsg.gadu-gadu.pl");
// gg_resolver_pthread_start() 0x8753188
** gg_event_free(0x8753198);
** gg_free_session(0x8753008);
** gg_resolver_pthread_cleanup(0x8753094 [0x8753188], 1);
Setting global pthread resolver
Testing local default resolver
** gg_login(0xffe0b23c: [uin=1, async=1, ...]);
** gg_watch_fd(0x8753008);
// gg_watch_fd() GG_STATE_RESOLVE_HUB_ASYNC
** gg_resolver_pthread_start(0x8753008, 0x8753094, "appmsg.gadu-gadu.pl");
// gg_resolver_pthread_start() 0x87531d8
** gg_event_free(0x8753198);
** gg_free_session(0x8753008);
** gg_resolver_pthread_cleanup(0x8753094 [0x87531d8], 1);
Testing local fork resolver
** gg_login(0xffe0b23c: [uin=1, async=1, ...]);
** gg_watch_fd(0x8753008);
// gg_watch_fd() GG_STATE_RESOLVE_HUB_ASYNC
** gg_resolver_fork_start(0x8753008, 0x8753094, "appmsg.gadu-gadu.pl");
// gg_resolver_fork_start() 0x8753188
** gg_event_free(0x8753198);
** gg_free_session(0x8753008);
Testing local pthread resolver
** gg_login(0xffe0b23c: [uin=1, async=1, ...]);
** gg_watch_fd(0x8753008);
// gg_watch_fd() GG_STATE_RESOLVE_HUB_ASYNC
** gg_resolver_pthread_start(0x8753008, 0x8753094, "appmsg.gadu-gadu.pl");
// gg_resolver_pthread_start() 0x87531d8
** gg_event_free(0x8753198);
** gg_free_session(0x8753008);
** gg_resolver_pthread_cleanup(0x8753094 [0x87531d8], 1);
Segmentation fault (core dumped)
[mockbuild@amaterasu automatic]$ ./resolver 
*** TEST 1 ***

Setting global fork resolver
Setting global pthread resolver
Setting global custom resolver
Setting global default resolver
Testing local default resolver
** gg_login(0xffea9c2c: [uin=1, async=1, ...]);
** gg_watch_fd(0x94fb008);
// gg_watch_fd() GG_STATE_RESOLVE_HUB_ASYNC
** gg_resolver_pthread_start(0x94fb008, 0x94fb094, "appmsg.gadu-gadu.pl");
// gg_resolver_pthread_start() 0x94fb1d8
** gg_event_free(0x94fb198);
** gg_free_session(0x94fb008);
** gg_resolver_pthread_cleanup(0x94fb094 [0x94fb1d8], 1);
Testing global default fork
Testing local fork resolver
** gg_login(0xffea9c2c: [uin=1, async=1, ...]);
** gg_watch_fd(0x94fb008);
// gg_watch_fd() GG_STATE_RESOLVE_HUB_ASYNC
** gg_resolver_fork_start(0x94fb008, 0x94fb094, "appmsg.gadu-gadu.pl");
// gg_resolver_fork_start() 0x94fb188
** gg_event_free(0x94fb198);
** gg_free_session(0x94fb008);
Testing local pthread resolver
** gg_login(0xffea9c2c: [uin=1, async=1, ...]);
** gg_watch_fd(0x94fb008);
// gg_watch_fd() GG_STATE_RESOLVE_HUB_ASYNC
** gg_resolver_pthread_start(0x94fb008, 0x94fb094, "appmsg.gadu-gadu.pl");
// gg_resolver_pthread_start() 0x94fb1d8
** gg_event_free(0x94fb198);
** gg_free_session(0x94fb008);
** gg_resolver_pthread_cleanup(0x94fb094 [0x94fb1d8], 1);
Setting global fork resolver
Testing local default resolver
** gg_login(0xffea9c2c: [uin=1, async=1, ...]);
** gg_watch_fd(0x94fb008);
// gg_watch_fd() GG_STATE_RESOLVE_HUB_ASYNC
** gg_resolver_fork_start(0x94fb008, 0x94fb094, "appmsg.gadu-gadu.pl");
// gg_resolver_fork_start() 0x94fb188
** gg_event_free(0x94fb198);
** gg_free_session(0x94fb008);
Testing local fork resolver
** gg_login(0xffea9c2c: [uin=1, async=1, ...]);
** gg_watch_fd(0x94fb008);
// gg_watch_fd() GG_STATE_RESOLVE_HUB_ASYNC
** gg_resolver_fork_start(0x94fb008, 0x94fb094, "appmsg.gadu-gadu.pl");
// gg_resolver_fork_start() 0x94fb1d8
** gg_event_free(0x94fb198);
** gg_free_session(0x94fb008);
Testing local pthread resolver
** gg_login(0xffea9c2c: [uin=1, async=1, ...]);
** gg_watch_fd(0x94fb008);
// gg_watch_fd() GG_STATE_RESOLVE_HUB_ASYNC
** gg_resolver_pthread_start(0x94fb008, 0x94fb094, "appmsg.gadu-gadu.pl");
// gg_resolver_pthread_start() 0x94fb188
** gg_event_free(0x94fb198);
** gg_free_session(0x94fb008);
** gg_resolver_pthread_cleanup(0x94fb094 [0x94fb188], 1);
Setting global pthread resolver
Testing local default resolver
** gg_login(0xffea9c2c: [uin=1, async=1, ...]);
** gg_watch_fd(0x94fb008);
// gg_watch_fd() GG_STATE_RESOLVE_HUB_ASYNC
** gg_resolver_pthread_start(0x94fb008, 0x94fb094, "appmsg.gadu-gadu.pl");
// gg_resolver_pthread_start() 0x94fb1d8
** gg_event_free(0x94fb198);
** gg_free_session(0x94fb008);
** gg_resolver_pthread_cleanup(0x94fb094 [0x94fb1d8], 1);
Testing local fork resolver
** gg_login(0xffea9c2c: [uin=1, async=1, ...]);
** gg_watch_fd(0x94fb008);
// gg_watch_fd() GG_STATE_RESOLVE_HUB_ASYNC
** gg_resolver_fork_start(0x94fb008, 0x94fb094, "appmsg.gadu-gadu.pl");
// gg_resolver_fork_start() 0x94fb188
** gg_event_free(0x94fb198);
** gg_free_session(0x94fb008);
Testing local pthread resolver
** gg_login(0xffea9c2c: [uin=1, async=1, ...]);
** gg_watch_fd(0x94fb008);
// gg_watch_fd() GG_STATE_RESOLVE_HUB_ASYNC
** gg_resolver_pthread_start(0x94fb008, 0x94fb094, "appmsg.gadu-gadu.pl");
// gg_resolver_pthread_start() 0x94fb1d8
** gg_event_free(0x94fb198);
** gg_free_session(0x94fb008);
** gg_resolver_pthread_cleanup(0x94fb094 [0x94fb1d8], 1);
Setting global custom resolver
Testing local default resolver
** gg_login(0xffea9c2c: [uin=1, async=1, ...]);
** gg_watch_fd(0x94fb008);
// gg_watch_fd() GG_STATE_RESOLVE_HUB_ASYNC
** custom resolver started
** gg_event_free(0x94fb198);
** gg_free_session(0x94fb008);
** custom resolver cleaning up
Testing local fork resolver
** gg_login(0xffea9c2c: [uin=1, async=1, ...]);
** gg_watch_fd(0x94fb008);
// gg_watch_fd() GG_STATE_RESOLVE_HUB_ASYNC
** gg_resolver_fork_start(0x94fb008, 0x94fb094, "appmsg.gadu-gadu.pl");
// gg_resolver_fork_start() 0x94fb188
** gg_event_free(0x94fb198);
** gg_free_session(0x94fb008);
Testing local pthread resolver
** gg_login(0xffea9c2c: [uin=1, async=1, ...]);
** gg_watch_fd(0x94fb008);
// gg_watch_fd() GG_STATE_RESOLVE_HUB_ASYNC
** gg_resolver_pthread_start(0x94fb008, 0x94fb094, "appmsg.gadu-gadu.pl");
// gg_resolver_pthread_start() 0x94fb1d8
** gg_event_free(0x94fb198);
** gg_free_session(0x94fb008);
** gg_resolver_pthread_cleanup(0x94fb094 [0x94fb1d8], 1);
Testing global default resolver in HTTP
=> -----BEGIN-HTTP-QUERY-----
GET /test HTTP/1.0

=> -----END-HTTP-QUERY-----
** gg_resolver_pthread_start(0x94fb008, 0x94fb054, "test");
// gg_resolver_pthread_start() 0x94fb1d8
// gg_http_connect() resolver = 0x94fb1d8
** gg_resolver_pthread_cleanup(0x94fb054 [0x94fb1d8], 1);
Testing global fork resolver in HTTP
=> -----BEGIN-HTTP-QUERY-----
GET /test HTTP/1.0

=> -----END-HTTP-QUERY-----
** gg_resolver_fork_start(0x94fb008, 0x94fb054, "test");
// gg_resolver_fork_start() 0x94fb1d8
// gg_http_connect() resolver = 0x94fb1d8
Testing global pthread resolver in HTTP
=> -----BEGIN-HTTP-QUERY-----
GET /test HTTP/1.0

=> -----END-HTTP-QUERY-----
** gg_resolver_pthread_start(0x94fb008, 0x94fb054, "test");
// gg_resolver_pthread_start() 0x94fb1d8
// gg_http_connect() resolver = 0x94fb1d8
** gg_resolver_pthread_cleanup(0x94fb054 [0x94fb1d8], 1);
Testing global custom resolver in HTTP
=> -----BEGIN-HTTP-QUERY-----
GET /test HTTP/1.0

=> -----END-HTTP-QUERY-----
** custom resolver started
// gg_http_connect() resolver = (nil)
** custom resolver cleaning up
Cleaning up after resolver tests...

*** TEST 2 (resolver 0) ***

** gg_login(0xffea9b4c: [uin=1, async=1, ...]);
** gg_watch_fd(0x94fb2b0);
// gg_watch_fd() GG_STATE_RESOLVE_HUB_ASYNC
** gg_resolver_pthread_start(0x94fb2b0, 0x94fb33c, "appmsg.gadu-gadu.pl");
// gg_resolver_pthread_start() 0x94fb188
** gg_event_free(0x94fb198);
** gg_watch_fd(0x94fb2b0);
// gg_watch_fd() GG_STATE_RESOLVING_HUB
** gg_resolver_pthread_cleanup(0x94fb33c [0x94fb188], 0);
// gg_watch_fd() resolved: 127.0.0.2
// gg_watch_fd() GG_STATE_CONNECT_HUB
// gg_watch_fd() connecting to 127.0.0.2:80
** gg_connect(127.0.0.2, 80, 1);
** gg_event_free(0x94fb198);
** gg_free_session(0x94fb2b0);
** gg_resolver_pthread_cleanup(0x94fb33c [(nil)], 1);

*** TEST 3 (resolver 0) ***

** gg_login(0xffea9b4c: [uin=1, async=1, ...]);
** gg_watch_fd(0x94fb008);
// gg_watch_fd() GG_STATE_RESOLVE_HUB_ASYNC
** gg_resolver_pthread_start(0x94fb008, 0x94fb094, "appmsg.gadu-gadu.pl");
// gg_resolver_pthread_start() 0x94fb1d8
** gg_event_free(0x94fb198);
** gg_free_session(0x94fb008);
** gg_resolver_pthread_cleanup(0x94fb094 [0x94fb1d8], 1);

*** TEST 4 (resolver 1) ***

** gg_login(0xffea9b4c: [uin=1, async=1, ...]);
** gg_watch_fd(0x94fb008);
// gg_watch_fd() GG_STATE_RESOLVE_HUB_ASYNC
** gg_resolver_fork_start(0x94fb008, 0x94fb094, "appmsg.gadu-gadu.pl");
// gg_resolver_fork_start() 0x94fb188
** gg_event_free(0x94fb198);
** gg_watch_fd(0x94fb008);
// gg_watch_fd() GG_STATE_RESOLVING_HUB
// gg_watch_fd() resolved: 127.0.0.2
// gg_watch_fd() GG_STATE_CONNECT_HUB
// gg_watch_fd() connecting to 127.0.0.2:80
** gg_connect(127.0.0.2, 80, 1);
** gg_event_free(0x94fb198);
** gg_free_session(0x94fb008);

*** TEST 5 (resolver 1) ***

** gg_login(0xffea9b4c: [uin=1, async=1, ...]);
** gg_watch_fd(0x94fb008);
// gg_watch_fd() GG_STATE_RESOLVE_HUB_ASYNC
** gg_resolver_fork_start(0x94fb008, 0x94fb094, "appmsg.gadu-gadu.pl");
// gg_resolver_fork_start() 0x94fb188
** gg_event_free(0x94fb198);
** gg_free_session(0x94fb008);

*** TEST 6 (resolver 2) ***

** gg_login(0xffea9b4c: [uin=1, async=1, ...]);
** gg_watch_fd(0x94fb008);
// gg_watch_fd() GG_STATE_RESOLVE_HUB_ASYNC
** gg_resolver_pthread_start(0x94fb008, 0x94fb094, "appmsg.gadu-gadu.pl");
// gg_resolver_pthread_start() 0x94fb1d8
** gg_event_free(0x94fb198);
** gg_watch_fd(0x94fb008);
// gg_watch_fd() GG_STATE_RESOLVING_HUB
** gg_resolver_pthread_cleanup(0x94fb094 [0x94fb1d8], 0);
// gg_watch_fd() resolved: 127.0.0.2
// gg_watch_fd() GG_STATE_CONNECT_HUB
// gg_watch_fd() connecting to 127.0.0.2:80
** gg_connect(127.0.0.2, 80, 1);
** gg_event_free(0x94fb198);
** gg_free_session(0x94fb008);
** gg_resolver_pthread_cleanup(0x94fb094 [(nil)], 1);

*** TEST 7 (resolver 2) ***

** gg_login(0xffea9b4c: [uin=1, async=1, ...]);
** gg_watch_fd(0x94fb008);
// gg_watch_fd() GG_STATE_RESOLVE_HUB_ASYNC
** gg_resolver_pthread_start(0x94fb008, 0x94fb094, "appmsg.gadu-gadu.pl");
// gg_resolver_pthread_start() 0x94fb1d8
** gg_event_free(0x94fb198);
** gg_free_session(0x94fb008);
** gg_resolver_pthread_cleanup(0x94fb094 [0x94fb1d8], 1);

_______________________________________________
libgadu-devel mailing list
libgadu-devel@lists.ziew.org
http://lists.ziew.org/mailman/listinfo/libgadu-devel

Reply via email to