You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a jtcl script that uses [socket -server serverProc 23456] to create a service. After another process's connect, some data will be read and a response will be written. I use a proc like this:
proc asyncProc {fd count} {
global data
catch {
puts "Writing $data..."
incr count
puts -nonewline $fd $data
set data {}
if {$count < 100} {
after 1000 "asyncProc $fd $count"
}
}
}
The global variable data will be filled otherwise, sending data will be started via
after 1000 "asyncProc $fd 0"
where fd is the socket handle passed to the serverProc during connect.
If the client closes the connection after some seconds,
I see "Writing ...." twice in the jtcl console, then a pause of several seconds, followed by the following console output:
Exception in thread "main" tcl.lang.TclRuntimeError: PutsCmd.cmdProc() Error: IOException when putting sock2
at tcl.lang.cmd.PutsCmd.cmdProc(PutsCmd.java:99)
at tcl.lang.Parser.evalObjv(Parser.java:833)
at tcl.lang.Parser.eval2(Parser.java:1223)
at tcl.lang.Interp.eval(Interp.java:2291)
at tcl.lang.Interp.eval(Interp.java:2365)
at tcl.lang.cmd.CatchCmd.cmdProc(CatchCmd.java:50)
at tcl.lang.Parser.evalObjv(Parser.java:833)
at tcl.lang.Parser.eval2(Parser.java:1223)
at tcl.lang.Procedure.cmdProc(Procedure.java:162)
at tcl.lang.Parser.evalObjv(Parser.java:833)
at tcl.lang.Parser.eval2(Parser.java:1223)
at tcl.lang.Interp.eval(Interp.java:2291)
at tcl.lang.Interp.eval(Interp.java:2365)
at tcl.lang.cmd.AfterCmd$TimerInfo.processTimerEvent(AfterCmd.java:481)
at tcl.lang.TimerHandler.invoke(TimerHandler.java:135)
at tcl.lang.TimerEvent.processEvent(Notifier.java:803)
at tcl.lang.Notifier.serviceEvent(Notifier.java:394)
at tcl.lang.Notifier.doOneEvent(Notifier.java:538)
at tcl.lang.Notifier.processTclEvents(Notifier.java:702)
at tcl.lang.Shell.main(Shell.java:167)
This should not happen because the catch socket IO happens within the catch block, the only effect should be that no new after command should be passed to the interpreter.
The text was updated successfully, but these errors were encountered:
Found a solution: Change line 99 of PutsCmd.java from
throw new TclRuntimeError(
to
throw new TclException(interp,
Afterwards, the error does no longer occur.
Should be fixed in next version
I have a jtcl script that uses [socket -server serverProc 23456] to create a service. After another process's connect, some data will be read and a response will be written. I use a proc like this:
proc asyncProc {fd count} {
global data
catch {
puts "Writing $data..."
incr count
puts -nonewline $fd $data
set data {}
if {$count < 100} {
after 1000 "asyncProc $fd $count"
}
}
}
The global variable data will be filled otherwise, sending data will be started via
after 1000 "asyncProc $fd 0"
where fd is the socket handle passed to the serverProc during connect.
If the client closes the connection after some seconds,
I see "Writing ...." twice in the jtcl console, then a pause of several seconds, followed by the following console output:
Exception in thread "main" tcl.lang.TclRuntimeError: PutsCmd.cmdProc() Error: IOException when putting sock2
at tcl.lang.cmd.PutsCmd.cmdProc(PutsCmd.java:99)
at tcl.lang.Parser.evalObjv(Parser.java:833)
at tcl.lang.Parser.eval2(Parser.java:1223)
at tcl.lang.Interp.eval(Interp.java:2291)
at tcl.lang.Interp.eval(Interp.java:2365)
at tcl.lang.cmd.CatchCmd.cmdProc(CatchCmd.java:50)
at tcl.lang.Parser.evalObjv(Parser.java:833)
at tcl.lang.Parser.eval2(Parser.java:1223)
at tcl.lang.Procedure.cmdProc(Procedure.java:162)
at tcl.lang.Parser.evalObjv(Parser.java:833)
at tcl.lang.Parser.eval2(Parser.java:1223)
at tcl.lang.Interp.eval(Interp.java:2291)
at tcl.lang.Interp.eval(Interp.java:2365)
at tcl.lang.cmd.AfterCmd$TimerInfo.processTimerEvent(AfterCmd.java:481)
at tcl.lang.TimerHandler.invoke(TimerHandler.java:135)
at tcl.lang.TimerEvent.processEvent(Notifier.java:803)
at tcl.lang.Notifier.serviceEvent(Notifier.java:394)
at tcl.lang.Notifier.doOneEvent(Notifier.java:538)
at tcl.lang.Notifier.processTclEvents(Notifier.java:702)
at tcl.lang.Shell.main(Shell.java:167)
This should not happen because the catch socket IO happens within the catch block, the only effect should be that no new after command should be passed to the interpreter.
The text was updated successfully, but these errors were encountered: