tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Konstantin Kolinko <knst.koli...@gmail.com>
Subject Re: Page not redirected after waitFor() call on Process object.
Date Wed, 05 Dec 2012 00:05:06 GMT
2012/11/23 Christopher Schultz <chris@christopherschultz.net>:
> On 11/21/12 4:42 AM, Andrei Petru Mura wrote:
>> TheProcessing.logoutSubscriberByMac(mac) has that code on it:
>>
>> public static void logoutSubscriberByMac(String mac) { try {
>>
>> Process proc = Runtime.getRuntime().exec("logout subscriber
>> command"); proc.waitFor(); //here is the problem
>
> You almost certainly have a problem with stream management: if you
> don't drain both the output stream and error stream of the process,
> then your code can hang. Likewise, if you don't close the standard
> input stream to the process, the child process may block waiting for
> input.
>
> It sounds silly, even if you use little or no standard input or output
> from your child process, but failure to manage these streams can and
> will hang up your Java code.
>
> You can either write multi-threaded code to handle all these streams,
> or you can use one of the several high-quality utility libraries out
> there that can wrap Runtime.exec for you and take care of this kind of
> stuff.
>

+1.

There was also such thread in June as
"Issue with keep-alive connections, when using APR Connector on
Windows and starting Processes from Servlets" where some JRE bugs were
mentioned.

http://markmail.org/thread/hsime5ayjdrg4fwm

I do not know much about your configuration to tell whether this is
affecting you or not.

Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message