[XML-SIG] Advice on how to deal with locking problems using python-wrapped
C libs in MT frameworks like Zope/Twisted?
Craeg K Strong
cstrong@arielpartners.com
Sun, 30 Mar 2003 15:53:10 -0500
Thanks for the great suggestion! =20
The following output is generated using strace with
Zope 2.6.1, Python 2.1, libxslt 1.0.27 on Red Hat Linux 8.0:
...
stat64("http://127.0.0.1:55068/testFolder_1_/arielpartners/propfolder/foo=
/properties",=20
0xbfffd57c) =3D -1 ENOENT (No such file or directory)
gettimeofday({1049056912, 152558}, NULL) =3D 0
getpid() =3D 12061
open("/etc/resolv.conf", O_RDONLY) =3D 11
fstat64(11, {st_mode=3DS_IFREG|0644, st_size=3D110, ...}) =3D 0
old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS,=20
-1, 0) =3D 0x40316000
read(11, "; generated by /sbin/dhclient-sc"..., 4096) =3D 110
read(11, "", 4096) =3D 0
close(11) =3D 0
munmap(0x40316000, 4096) =3D 0
socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) =3D 11
fcntl64(11, F_GETFL) =3D 0x2 (flags O_RDWR)
fcntl64(11, F_SETFL, O_RDWR|O_NONBLOCK) =3D 0
connect(11, {sin_family=3DAF_INET, sin_port=3Dhtons(55068),=20
sin_addr=3Dinet_addr("127.0.0.1")}}, 16) =3D -1 EINPROGRESS (Operation no=
w=20
in progress)
select(12, NULL, [11], NULL, {60, 0}) =3D 1 (out [11], left {60, 0})
getsockopt(11, SOL_SOCKET, SO_ERROR, [0], [4]) =3D 0
send(11, "GET /testFolder_1_/arielpartners"..., 88, 0) =3D 88
brk(0) =3D 0x8b4d000
brk(0x8b5d000) =3D 0x8b5d000
recv(11, 0x8b4cfd8, 4096, 0) =3D -1 EAGAIN (Resource=20
temporarily unavailable)
select(12, [11], NULL, NULL, {60, 0}) =3D 0 (Timeout) =20
<=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D LENGTHY TIMEOUT HAPPEN=
S HERE
recv(11, 0x8b4cfd8, 4096, 0) =3D -1 EAGAIN (Resource=20
temporarily unavailable)
select(12, [11], NULL, NULL, {60, 0}) =3D 0 (Timeout) =20
<=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D AND AGAIN HERE
kill(12063, SIGRTMIN) =3D 0
rt_sigprocmask(SIG_SETMASK, NULL, [RTMIN], 8) =3D 0
rt_sigsuspend([] <unfinished ...>
--- SIGRTMIN (Unknown signal 32) ---
<... rt_sigsuspend resumed> ) =3D -1 EINTR (Interrupted system =
call)
sigreturn() =3D ? (mask now [RTMIN])
close(11) =3D 0
kill(12063, SIGRTMIN) =3D 0
write(2, "^\n\n", 3^
) =3D 3
write(2, "FAIL", 4FAIL)=20
.... lots of messages follow to print out the errors
When libxslt tries to resolve the relative URL, a request is going out=20
to grab:
http://127.0.0.1:55068/testFolder_1_/arielpartners/propfolder/foo/propert=
ies
which ends up coming back in to Zope. Zope is multi-threaded, so why
shouldn't that be able to return successfully? Is libxslt-python somehow
holding on to the GIL or-- maybe it is still in the middle of the "read"
call and is therefore holding a lock on that resource?
Thanks in advance,
--Craeg
Martin v. L=F6wis wrote:
>Craeg K Strong <cstrong@arielpartners.com> writes:
> =20
>
>>Yes. Based on the above information, can you suggest a direction of
>>inquiry?
>> =20
>>
>
>I suggest to investigate this with strace.
>
>Regards,
>Martin
> =20
>