Strange error in multiprocess communication

Gautham Anil <[email protected]> Sun, 09 Apr 2006 13:37:33 +0530
Newsgroups gmane.lisp.scheme.scsh
Message-ID <[email protected]>
Hi,

I am building a multi process multi threaded application (for research 
purposes). It involves a process (say client-process) communicating in 
its only thread to one of many threads in another process (say 
controller) using TCP/IP. The client-process sleeps occasionally. Note 
that there are many client-processes and only one controller. All 
processes are in the same machine for now.

The communication contents is scheme. I use

(call-with-values
	(socket-client ip port)
	(lambda (in out)
		<< code >>
		(display << message >> out)
		....
	))

for communication.

This error was thrown by the controller.

<< Error from a run >>
Error: exception
        os-error
        (channel-maybe-read 104 '#{Byte-vector (length 4096) 40 115 101 
110 100 ---} 0 4096 #t ---)


<< Error from another run (the errors are identical) >>
Error: exception
        os-error
        (channel-maybe-read 104 '#{Byte-vector (length 4096) 40 115 101 
110 100 ---} 0 4096 #t ---)
1>

<< Which I debugged and traced all the way down to the portion of my 
code in the controller that reads from sockets >>

1>
1> ,debug
'#{Exception-continuation (pc 30) (loop in unnamed in channel-read in 
scheme-level-0)}

  [0] 0
  [1] '#{Procedure 458 (loop in unnamed in channel-read ---)}
  [2] #t
  [3] 1
  [4] 4096
  [5] '#{Byte-vector (length 4096) 40 115 101 110 ---}
  [6] 0
  [7] 'any
  [8] '#{Input-channel "socket connection"}
inspect: ,d
'#{Continuation (pc 104) (unnamed in read-char-handler in i/o)}

  [0] '#{Input-port #{Input-channel "socket connection"}}
  [1] #t
inspect: ,d
'#{Continuation (pc 62) (with-dynamic-env in fluids)}

  [0] '#{Procedure 1109 (unnamed in with-dynamic-env in fluids)}
  [1] '((# # # # # ---) (# . #) (# # # # # ---) (# # # # #) (# # # #) ---)
  [2] #f
  [3] #f
inspect: ,d
'#{Continuation (pc 35) (protect-port-op in i/o)}

  [0] '#{Input-port #{Input-channel "socket connection"}}
  [1] '#{Procedure 1716 (unnamed in unnamed in one-arg-proc->handler ---)}
inspect: ,d
'#{Exception-continuation (pc 7) (sub-read in reading)}

  [0] '#{Input-port #{Input-channel "socket connection"}}
inspect: ,d
'#{Continuation (pc 14) (loop in read in reading)}

  [0] '#{Procedure 1963 (loop in read in reading)}
  [1] '#{Input-port #{Input-channel "socket connection"}}
  [2] '(#{Input-port #})
inspect: ,d
'#{Continuation (pc 14) (read-loop in unnamed in unnamed ---)}

<< I wrote read-loop >>

  [0: read-loop] '#{Procedure 16612 (read-loop in unnamed in unnamed ---)}
  [1: in] '#{Input-port #{Input-channel "socket connection"}}
  [2: out] '#{Output-port #{Output-channel "socket connection"}}
  [3: socket] '#{Socket 32942}
  [4: id] 3
  [5: pr] '#{Procedure 16602 (pr in unnamed in make-server)}
  [6: self] '#{Procedure 16601 (self in unnamed in make-server)}
  [7: self-data] '#{Server-info}
  [8: command] 'do-client
  [9: params] '(#{Input-port #} #{Output-port #} #{Socket 32942} 3)
  [10: s-info] '#{Server-info}
  [11: name] "ChL"
  [12: port] -1
  [13: control-command-handler] '#{Procedure 16592 (unnamed in 
make-server1)}
  [14: client-command-handler] '#{Procedure 16594 (unnamed in make-server1)}
inspect:


While researching this problem, I found this message though it does not 
recommend a solution.

http://www.scsh.net/mail-archive/scsh-users/2004-02/msg00009.html

Please tell me how to solve this problem. Thanks in advance.

-- 
Gautham Anil
M.Tech Student