[Xprint] Re: Hang with "-XpSpoolerType cups" - gdb traces
Philip Webley
philip.webley at gmx.at
Mon Jun 21 23:44:04 EDT 2004
Hi
xprint-request at mozdev.org wrote:
>> > Another question is definetely about xprint. When experimenting, I
>> > decided to try option -XpSpoolerType cups. This resulted in deadlocking
>> > of the clients. Even xphelloworld was deadlocked. The printing was done,
>> > but I guess the socket was not closed after it, so the client was
>> > sitting there till the server was terminated. I do have CUPS running so
>> > I find this behaviour kind of strange. As far as I understand the
>> > default value for this option is 'bsd:cups'
>>[snip]
>>
>>I had the same sort of trouble but was able to fix it by specifying
>>
>>*xp-spooler-command: /usr/bin/lp -s
>>
>>in /etc/Xprint/C/print/attributes/printer
>>
>>This suppresses console output from lp, so it looks like the output
>>(printjob ID) from lp is confusing Xprt somehow.
>
>
> Weired, very weired.
>
> David Schweiger had a good idea - can you try to attach gdb to the Xprt
> process and provide a stack trace of the hung Xprt, please ?
>
OK, I compiled xprint with -g and got these gdb traces for Xprt and
xphelloworld (taken with the system hung). I'm not skilled with gdb but
maybe you can make something out of them:
--snip--
This GDB was configured as "i386-linux"...Using host libthread_db
library "/lib/libthread_db.so.1".
Attaching to program: /usr/local/bin/Xprt, process 9243
Reading symbols from /lib/libm.so.6...done.
Loaded symbols for /lib/libm.so.6
Reading symbols from /lib/libc.so.6...done.
Loaded symbols for /lib/libc.so.6
Reading symbols from /lib/ld-linux.so.2...done.
Loaded symbols for /lib/ld-linux.so.2
0x40117dd2 in select () from /lib/libc.so.6
(gdb) bt
#0 0x40117dd2 in select () from /lib/libc.so.6
#1 0x40176510 in ?? () from /lib/libc.so.6
#2 0x400164a0 in ?? () from /lib/ld-linux.so.2
#3 0xbffff360 in ?? ()
#4 0x08083587 in WaitForSomething (pClientsReady=0xbffff3a4) at
WaitFor.c:323
#5 0x08071a6a in Dispatch () at dispatch.c:253
#6 0x0805889f in main (argc=12, argv=0xbffff854) at main.c:364
(gdb)
--snip--
--snip--
This GDB was configured as "i386-linux"...Using host libthread_db
library "/lib/libthread_db.so.1".
Attaching to program: /usr/bin/xphelloworld, process 9278
Reading symbols from /usr/X11R6/lib/libXext.so.6...done.
Loaded symbols for /usr/X11R6/lib/libXext.so.6
Reading symbols from /usr/X11R6/lib/libX11.so.6...done.
Loaded symbols for /usr/X11R6/lib/libX11.so.6
Reading symbols from /usr/X11R6/lib/libXp.so.6...done.
Loaded symbols for /usr/X11R6/lib/libXp.so.6
Reading symbols from /lib/libm.so.6...done.
Loaded symbols for /lib/libm.so.6
Reading symbols from /lib/libc.so.6...done.
Loaded symbols for /lib/libc.so.6
Reading symbols from /lib/libdl.so.2...done.
Loaded symbols for /lib/libdl.so.2
Reading symbols from /lib/ld-linux.so.2...done.
Loaded symbols for /lib/ld-linux.so.2
Reading symbols from /lib/libnss_compat.so.2...done.
Loaded symbols for /lib/libnss_compat.so.2
Reading symbols from /lib/libnsl.so.1...done.
Loaded symbols for /lib/libnsl.so.1
Reading symbols from /lib/libnss_nis.so.2...done.
Loaded symbols for /lib/libnss_nis.so.2
Reading symbols from /lib/libnss_files.so.2...done.
Loaded symbols for /lib/libnss_files.so.2
0x401f5dd2 in select () from /lib/libc.so.6
(gdb) bt
#0 0x401f5dd2 in select () from /lib/libc.so.6
#1 0x400f8d28 in ?? () from /usr/X11R6/lib/libX11.so.6
#2 0x0804f988 in ?? ()
#3 0x00000000 in ?? ()
#4 0x40065e92 in _XPollfdCacheDel () from /usr/X11R6/lib/libX11.so.6
#5 0x40066e01 in _XRead () from /usr/X11R6/lib/libX11.so.6
#6 0x40066a54 in _XReadEvents () from /usr/X11R6/lib/libX11.so.6
#7 0x40051e32 in XIfEvent () from /usr/X11R6/lib/libX11.so.6
#8 0x0804b457 in XpuWaitForPrintNotify ()
#9 0xbffff6a0 in ?? ()
#10 0x0804b3f0 in XpuGetOneLongAttribute ()
Previous frame inner to this frame (corrupt stack?)
(gdb)
--snip--
BTW, Where is stdout from lp *supposed* to go? Is it used for anything?
I tried redirecting stdout to /dev/null in SendFileToCommand() in
xprint/src/xprint_main/xc/programs/Xserver/Xprint/attributes.c
using the following patch - this also fixes the problem:
--snip--
***
/usr/local/src/xprint-xprintorg-0.0.9.final/xprint/src/xprint_main/xc/programs/Xserver/Xprint/attributes.c
Sat Jun 19 23:48:13 2004
---
/usr/local/src/xprint-xprintorg-0.0.9.final/local-patches/attributes.c
Sun Jun 20 12:46:19 2004
***************
*** 1127,1132 ****
--- 1127,1133 ----
{
pid_t childPid;
int pipefd[2];
+ int fd;
int status;
struct stat statBuf;
FILE *fp, *outPipe;
***************
*** 1155,1161 ****
close(0);
dup(pipefd[0]);
close(pipefd[0]);
!
/*
* If a user name is specified, try to set our uid to match that
* user name. This is to allow e.g. a banner page to show the
--- 1156,1166 ----
close(0);
dup(pipefd[0]);
close(pipefd[0]);
!
! /* redirect stdout to /dev/null */
! close(1);
! fd = open("/dev/null", O_RDWR);
!
/*
* If a user name is specified, try to set our uid to match that
* user name. This is to allow e.g. a banner page to show the
--snip--
The problem is only with stdout - output to stderr goes to a logfile
quite normally and doesn't cause the system to hang.
ciao
Phil Webley
More information about the Xprint
mailing list