Forum OpenACS Q&A: Re: Is it possible to use the native exec command while also using nsproxy?

As you wrote, there is - out of the box - currently no way to access the original exec in connection threads. You can certainly comment out the last command of acs-tcl/tcl/proxy-procs.tcl and call "proxy::exec" or "exec" depending on your needs.

however, i am wondering, what the certain cases are, where you want to call the original exec?

I have an infinite loop that waits on a blocking perl script, and sometimes it can iterate extremely quickly, causing deadlocks.
It is probably better to do the iterations in a script rather than doing multiple execs from the connection threads. not sure, this is possible in your situation.

Unfortunately, tcl's "interp alias" does not help to preserve the original exec command. The only way i found was to use the "alias" method of xotcl2/nsf. If that's an option for you I'll summarize how to this.

I would normally agree, but the code in the perl script cannot be done in tcl reasonably.
i was not suggesting to replace the perl stuff by tcl. In case you have a quick loop with many execs of the form
   while {...} {
      set x [exec perl script.pl]
   }
it would be better to make yet another script containing the loop + call of the perl script, and call this additional script via a single exec.
I see what you mean.

I'm not sure if that is possible in this case. After the perl script returns, it outputs a string containing a file path and then is passed to a different proc. If my perl script never returns, I can never pass it back to the tcl?

I'm left wondering about the nature of the deadlock error within proxy::exec. Is it some sort of timing issue that can be solved with a sleep command? If you have any information on how this happens, that would be greatly appreciated.

i have never seen proxy::exec leading to a deadlock. How are you handling the situation when the perl script never returns? ns_proxy (the machinery used by proxy::exec) has several timeouts [1]. Can it be that your server is running out of slaves? Are you using AOLserver or NaviServer?

-gn
[1] http://naviserver.sourceforge.net/n/nsproxy/files/ns_proxy.html