Re: net problem

Wim Taymans (wim.taymans@tvd.be)
Sun, 22 Aug 1999 19:00:20 +0200

--------------BEA5EA5946E0233C35823097
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Andreas Beck wrote:

>

Hi, thanks for replying

<snip>

> The root is not so nice, but o.k. for testing. I myself use "nobody" and
> have a setgid saned for minimum risk, but for a first test, root should be
> o.k.
>
> And I suppose you have sent SIGHUP to inetd, so it rereads its config -
> right ?
>

Sure.

> > this is the output I get (with SANE_DEBUG_NET=128), the first
> > succesfull probe is from the local microtek2 backend, the other
> > failing probe is from the net driver. Needless to say, the net
>
> > [sanei_init_debug]: Setting debug level of net to 128.
> > [net] adding backend localhost
> > [net] get_devices: ignoring rpc-returned status Unknown SANE status code 168448867
>
> This is very weird. This sounds like the sane daemon failing very very early
> or not connecting at all. Try straceing both sides of the connection.
> The logs should give a clue on that.
>
> The daemon side might be a bit tricky, as it appears, when the connection is
> made, started from inetd. There are two possible ways to get around this:
>
> 1. Make a small script "ssaned", that looks like
> #!/bin/bash
> exec strace saned 2>/tmp/logfile
>
> 2. use "strace -p [pid_of_inetd] -f" to attach to the inetd, and "-f"ollow
> when it forks off the saned.
>

I allready straced but couldn't make sense out of it. I'll show what I think to be the
interesting part (the saned started from inetd):

...
15526 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
15526 rt_sigprocmask(SIG_BLOCK, ~[], [], 8) = 0
15526 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
15526 rt_sigprocmask(SIG_BLOCK, ~[], [], 8) = 0
15526 write(7, "*\0\0\0\204\0\0\0\1\0\0\0\0\0\0\0"..., 42) = 42
15526 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
15526 select(8, [7], NULL, NULL, NULL) = 1 (in [7])
15526 rt_sigprocmask(SIG_BLOCK, ~[], [], 8) = 0
15526 read(7, "\204\0\0\0\204\0\0\0\1\0\0\0\0\0"..., 132) = 132
15526 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
15526 rt_sigprocmask(SIG_BLOCK, ~[], [], 8) = 0
15526 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
15526 close(7) = 0
15526 open("/dev/sga", O_RDWR|O_EXCL) = 7
15526 ioctl(7, TIOCSCCINI, 0xbffff300) = 0
15526 rt_sigprocmask(SIG_BLOCK, ~[], [], 8) = 0
15526 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
15526 rt_sigprocmask(SIG_BLOCK, ~[], [], 8) = 0
15526 write(7, ".\0\0\0L\0\0\0\2\0\0\0\0\0\0\0\0"..., 46) = 46
15526 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
15526 select(8, [7], NULL, NULL, NULL) = 1 (in [7])
15526 rt_sigprocmask(SIG_BLOCK, ~[], [], 8) = 0
15526 read(7, "L\0\0\0L\0\0\0\2\0\0\0\0\0\0\0\0"..., 76) = 76
15526 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
15526 rt_sigprocmask(SIG_BLOCK, ~[], [], 8) = 0
15526 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
15526 close(7) = 0
15526 write(2, "\n\nScanner attributes from devi"..., 43) = 43
15526 write(2, "================================"..., 41) = 41
15526 write(2, "\nScanner ID...\n", 15) = 15
15526 write(2, "~~~~~~~~~~~~~\n", 14) = 14
15526 write(2, " Vendor Name: \' "..., 33) = 33
15526 write(2, " Model Name: \'Scanner "..., 41) = 41
15526 write(2, " Revision: \'1.40\'\n"..., 29) = 29
15526 write(2, " Model Code: 0x91 (", 28) = 28
15526 write(2, "X6", 2) = 2
15526 write(2, ")\n", 2) = 2
15526 write(2, " Device Type Code: 0x06 (Scan"..., 38) = 38
15526 write(2, " Scanner type: ", 22) = 22
15526 write(2, "Flatbed scanner\n", 16) = 16
15526 write(2, " Supported options: Automatic "..., 53) = 53
15526 write(2, " Transparen"..., 54) = 54
15526 write(2, " Auto paper"..., 48) = 48
15526 write(2, " Advanced p"..., 50) = 50
15526 write(2, " Stripes: N"..., 34) = 34
15526 write(2, " Slides: No"..., 33) = 33
15526 write(2, " Scan button: Yes\n", 26) = 26
15526 write(2, "\nImaging Capabilities...\n", 25) = -1 EPIPE (Broken pipe)
15526 --- SIGPIPE (Broken pipe) ---
15526 munmap(0x40171000, 81048) = 0
15526 time([935340345]) = 935340345
15526 getpid() = 15526
15526 rt_sigaction(SIGPIPE, {0x40122de0, [], 0x4000000}, {0x804969c, [],
SA_RESTART|0x4000000}, 8) = 0
15526 send(3, "<30>Aug 22 18:45:45 saned[15526]"..., 43, 0) = 43
15526 rt_sigaction(SIGPIPE, {0x804969c, [], SA_RESTART|0x4000000}, NULL, 8) = 0
15526 close(3) = 0
15526 _exit(0) = ?
289 <... select resumed> ) = ? ERESTARTNOHAND (To be restarted)
289 --- SIGCHLD (Child exited) ---
289 wait4(-1, [WIFEXITED(s) && WEXITSTATUS(s) == 0], WNOHANG, NULL) = 15526
289 wait4(-1, 0xbffff9e8, WNOHANG, NULL) = -1 ECHILD (No child processes)
289 sigreturn() = ? (mask now [])
289 select(23, [4 5 6 8 10 11 12 13 14 15 16 17 18 19 20 22], NULL, NULL, NULL
<unfinished ...>

The SIGPIPE is weird.

The other end of the network (scanimage -L, with just the net driver active):

...
read(25, "\10\0\0\0\\\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(25, "\10\0\0\0\205\2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(25, "\7\0\0\0\206\2\0\0tty1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(25, "\6\0\0\0\207\2\0\0tty2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(25, "\6\0\0\0\210\2\0\0tty3\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(25, "\6\0\0\0\211\2\0\0tty4\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(25, "\6\0\0\0\212\2\0\0tty5\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(25, "\6\0\0\0\213\2\0\0tty6\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(25, "\10\0\0\0\235\v\0\0ttyp0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(25, "\10\0\0\0Bb\0\0ttyp1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(25, "\10\0\0\0\370=\0\0ttyp2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(25, "\7\0\0\0\277d\0\0ttyp3\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
fcntl(25, F_SETLKW, {type=F_UNLCK, whence=SEEK_SET, start=0, len=0}) = 0
rt_sigaction(SIGALRM, {SIG_DFL}, NULL, 8) = 0
alarm(0) = 1
close(25) = 0
write(24, "\0\0\0\0\1\0\0\3\0\0\0\4wim\0", 16) = 16
read(24, "\0\0\0\0\1\0\0\3", 8192) = 8
write(24, "\0\0\0\1", 4) = 4
read(24, "\n\nScanner attributes from device"..., 8192) = 43
write(2, "[net] get_devices: ignoring rpc-"..., 83[net] get_devices: ignoring
rpc-returned status Unknown SANE status code 168448867
) = 83
munmap(0x40169000, 105240) = 0
munmap(0x40183000, 33368) = 0
munmap(0x4018c000, 60568) = 0
munmap(0x4019b000, 42616) = 0
munmap(0x401a6000, 32056) = 0
munmap(0x401ae000, 37624) = 0
munmap(0x401b8000, 33180) = 0
munmap(0x401c1000, 61468) = 0
munmap(0x401d1000, 83288) = 0
munmap(0x401e6000, 72184) = 0
munmap(0x401f8000, 105808) = 0
munmap(0x40212000, 47548) = 0
munmap(0x4021e000, 31320) = 0
munmap(0x40226000, 54616) = 0
munmap(0x40234000, 64920) = 0
munmap(0x40244000, 50680) = 0
munmap(0x40251000, 48152) = 0
munmap(0x4025d000, 41688) = 0
munmap(0x40268000, 35288) = 0
write(2, "[net] exiting\n", 14[net] exiting
) = 14
write(2, "[net] closing dev 0x8058190, ctl"..., 36[net] closing dev 0x8058190, ctl=24
) = 36
write(24, "\0\0\0\n", 4) = 4
close(24) = 0
munmap(0x40019000, 25628) = 0
_exit(0) = ?

It stops right after the first 43 bytes = the first line of data.

More strangeness: If I do saned -d, it works (just once though)...

I was just thinking, is this due to the text appearing at startup. somehow
saned started from inetd seems to also send this to the client, where with saned -d
you only get to see the result of the probe, while the text is on the
console where I started saned -d.

>
> CU, Andy

Wim

>
>
> --
> = Andreas Beck | Email : <andreas.beck@ggi-project.org> =
>
> --
> Source code, list archive, and docs: http://www.mostang.com/sane/
> To unsubscribe: echo unsubscribe sane-devel | mail majordomo@mostang.com

--
"What people have been reduced to are mere 3-D representations of their own
data."
-- Arthur Miller

--------------BEA5EA5946E0233C35823097 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit

<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> Andreas Beck wrote:

 
Hi, thanks for replying

<snip>

The root is not so nice, but o.k. for testing. I myself use "nobody" and
have a setgid saned for minimum risk, but for a first test, root should be
o.k.

And I suppose you have sent SIGHUP to inetd, so it rereads its config -
right ?
 

Sure.
> this is the output I get (with SANE_DEBUG_NET=128), the first
> succesfull probe is from the local microtek2 backend, the other
> failing probe is from the net driver. Needless to say, the net

> [sanei_init_debug]: Setting debug level of net to 128.
> [net] adding backend localhost
> [net] get_devices: ignoring rpc-returned status Unknown SANE status code 168448867

This is very weird. This sounds like the sane daemon failing very very early
or not connecting at all. Try straceing both sides of the connection.
The logs should give a clue on that.

The daemon side might be a bit tricky, as it appears, when the connection is
made, started from inetd. There are two possible ways to get around this:

1. Make a small script "ssaned", that looks like
#!/bin/bash
exec strace saned 2>/tmp/logfile

2. use "strace -p [pid_of_inetd] -f" to attach to the inetd, and "-f"ollow
when it forks off the saned.
 

I allready straced but couldn't make sense out of it. I'll show what I think to be the
interesting part (the saned started from inetd):

...
15526 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
15526 rt_sigprocmask(SIG_BLOCK, ~[], [], 8) = 0
15526 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
15526 rt_sigprocmask(SIG_BLOCK, ~[], [], 8) = 0
15526 write(7, "*\0\0\0\204\0\0\0\1\0\0\0\0\0\0\0"..., 42) = 42
15526 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
15526 select(8, [7], NULL, NULL, NULL)  = 1 (in [7])
15526 rt_sigprocmask(SIG_BLOCK, ~[], [], 8) = 0
15526 read(7, "\204\0\0\0\204\0\0\0\1\0\0\0\0\0"..., 132) = 132
15526 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
15526 rt_sigprocmask(SIG_BLOCK, ~[], [], 8) = 0
15526 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
15526 close(7)                          = 0
15526 open("/dev/sga", O_RDWR|O_EXCL)   = 7
15526 ioctl(7, TIOCSCCINI, 0xbffff300)  = 0
15526 rt_sigprocmask(SIG_BLOCK, ~[], [], 8) = 0
15526 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
15526 rt_sigprocmask(SIG_BLOCK, ~[], [], 8) = 0
15526 write(7, ".\0\0\0L\0\0\0\2\0\0\0\0\0\0\0\0"..., 46) = 46
15526 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
15526 select(8, [7], NULL, NULL, NULL)  = 1 (in [7])
15526 rt_sigprocmask(SIG_BLOCK, ~[], [], 8) = 0
15526 read(7, "L\0\0\0L\0\0\0\2\0\0\0\0\0\0\0\0"..., 76) = 76
15526 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
15526 rt_sigprocmask(SIG_BLOCK, ~[], [], 8) = 0
15526 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
15526 close(7)                          = 0
15526 write(2, "\n\nScanner attributes from devi"..., 43) = 43
15526 write(2, "================================"..., 41) = 41
15526 write(2, "\nScanner ID...\n", 15) = 15
15526 write(2, "~~~~~~~~~~~~~\n", 14)   = 14
15526 write(2, "  Vendor Name:        \'        "..., 33) = 33
15526 write(2, "  Model Name:         \'Scanner "..., 41) = 41
15526 write(2, "  Revision:           \'1.40\'\n"..., 29) = 29
15526 write(2, "  Model Code:         0x91 (", 28) = 28
15526 write(2, "X6", 2)                 = 2
15526 write(2, ")\n", 2)                = 2
15526 write(2, "  Device Type Code:   0x06 (Scan"..., 38) = 38
15526 write(2, "  Scanner type:       ", 22) = 22
15526 write(2, "Flatbed scanner\n", 16) = 16
15526 write(2, "  Supported options:  Automatic "..., 53) = 53
15526 write(2, "                      Transparen"..., 54) = 54
15526 write(2, "                      Auto paper"..., 48) = 48
15526 write(2, "                      Advanced p"..., 50) = 50
15526 write(2, "                      Stripes: N"..., 34) = 34
15526 write(2, "                      Slides: No"..., 33) = 33
15526 write(2, "  Scan button:        Yes\n", 26) = 26
15526 write(2, "\nImaging Capabilities...\n", 25) = -1 EPIPE (Broken pipe)
15526 --- SIGPIPE (Broken pipe) ---
15526 munmap(0x40171000, 81048)         = 0
15526 time([935340345])                 = 935340345
15526 getpid()                          = 15526
15526 rt_sigaction(SIGPIPE, {0x40122de0, [], 0x4000000}, {0x804969c, [], SA_RESTART|0x4000000}, 8) = 0
15526 send(3, "<30>Aug 22 18:45:45 saned[15526]"..., 43, 0) = 43
15526 rt_sigaction(SIGPIPE, {0x804969c, [], SA_RESTART|0x4000000}, NULL, 8) = 0
15526 close(3)                          = 0
15526 _exit(0)                          = ?
289   <... select resumed> )            = ? ERESTARTNOHAND (To be restarted)
289   --- SIGCHLD (Child exited) ---
289   wait4(-1, [WIFEXITED(s) && WEXITSTATUS(s) == 0], WNOHANG, NULL) = 15526
289   wait4(-1, 0xbffff9e8, WNOHANG, NULL) = -1 ECHILD (No child processes)
289   sigreturn()                       = ? (mask now [])
289   select(23, [4 5 6 8 10 11 12 13 14 15 16 17 18 19 20 22], NULL, NULL, NULL <unfinished ...>

The SIGPIPE is weird.

The other end of the network (scanimage -L, with just the net driver active):

...
read(25, "\10\0\0\0\\\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(25, "\10\0\0\0\205\2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(25, "\7\0\0\0\206\2\0\0tty1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(25, "\6\0\0\0\207\2\0\0tty2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(25, "\6\0\0\0\210\2\0\0tty3\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(25, "\6\0\0\0\211\2\0\0tty4\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(25, "\6\0\0\0\212\2\0\0tty5\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(25, "\6\0\0\0\213\2\0\0tty6\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(25, "\10\0\0\0\235\v\0\0ttyp0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(25, "\10\0\0\0Bb\0\0ttyp1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(25, "\10\0\0\0\370=\0\0ttyp2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(25, "\7\0\0\0\277d\0\0ttyp3\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
fcntl(25, F_SETLKW, {type=F_UNLCK, whence=SEEK_SET, start=0, len=0}) = 0
rt_sigaction(SIGALRM, {SIG_DFL}, NULL, 8) = 0
alarm(0)                                = 1
close(25)                               = 0
write(24, "\0\0\0\0\1\0\0\3\0\0\0\4wim\0", 16) = 16
read(24, "\0\0\0\0\1\0\0\3", 8192)      = 8
write(24, "\0\0\0\1", 4)                = 4
read(24, "\n\nScanner attributes from device"..., 8192) = 43
write(2, "[net] get_devices: ignoring rpc-"..., 83[net] get_devices: ignoring rpc-returned status Unknown SANE status code 168448867
) = 83
munmap(0x40169000, 105240)              = 0
munmap(0x40183000, 33368)               = 0
munmap(0x4018c000, 60568)               = 0
munmap(0x4019b000, 42616)               = 0
munmap(0x401a6000, 32056)               = 0
munmap(0x401ae000, 37624)               = 0
munmap(0x401b8000, 33180)               = 0
munmap(0x401c1000, 61468)               = 0
munmap(0x401d1000, 83288)               = 0
munmap(0x401e6000, 72184)               = 0
munmap(0x401f8000, 105808)              = 0
munmap(0x40212000, 47548)               = 0
munmap(0x4021e000, 31320)               = 0
munmap(0x40226000, 54616)               = 0
munmap(0x40234000, 64920)               = 0
munmap(0x40244000, 50680)               = 0
munmap(0x40251000, 48152)               = 0
munmap(0x4025d000, 41688)               = 0
munmap(0x40268000, 35288)               = 0
write(2, "[net] exiting\n", 14[net] exiting
)         = 14
write(2, "[net] closing dev 0x8058190, ctl"..., 36[net] closing dev 0x8058190, ctl=24
) = 36
write(24, "\0\0\0\n", 4)                = 4
close(24)                               = 0
munmap(0x40019000, 25628)               = 0
_exit(0)                                = ?

It stops right after the first 43 bytes = the first line of data.

More strangeness: If I do saned -d, it works (just once though)...

I was just thinking, is this due to the text appearing at startup. somehow
saned started from inetd seems to also send this to the client, where with saned -d
you only get to see the result of the probe, while the text is on the
console where I started saned -d.

 
CU, Andy
Wim
 

--
= Andreas Beck                    |  Email :  <andreas.beck@ggi-project.org> =

--
Source code, list archive, and docs: http://www.mostang.com/sane/
To unsubscribe: echo unsubscribe sane-devel | mail majordomo@mostang.com

-- 
"What people have been reduced to are mere 3-D representations of their own 
data."
-- Arthur Miller
  --------------BEA5EA5946E0233C35823097-- -- Source code, list archive, and docs: http://www.mostang.com/sane/ To unsubscribe: echo unsubscribe sane-devel | mail majordomo@mostang.com