You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@uima.apache.org by Jörn Kottmann <ko...@gmail.com> on 2009/08/05 00:01:46 UTC

UIMA AS java.io.IOException: Bad file descriptor when started in background on unix

Hi,

on our severs I start UIMA AS in the background and redirect
the output to a file.

Here is the actual command:
nohup bin/deployAsyncService.sh XXX/desc/Deploy_XXX.xml > console.out &

The output file always contains this exception after UIMA AS started:
java.io.IOException: Bad file descriptor
    at java.io.FileInputStream.readBytes(Native Method)
    at java.io.FileInputStream.read(FileInputStream.java:199)
    at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
    at java.io.BufferedInputStream.read(BufferedInputStream.java:237)
    at 
org.apache.uima.adapter.jms.service.UIMA_Service.main(UIMA_Service.java:422)

Thanks,
Jörn

Re: UIMA AS java.io.IOException: Bad file descriptor when started in background on unix

Posted by Jaroslaw Cwiklik <ui...@gmail.com>.
Jorn, you can use jConsole to quiesce the service. You must know the JMX
port number of the service for this. I can suggest that you set the
following before starting the service:
set UIMA_JVM_OPTS=-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=8009
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false

Here the JMX MBeanServer is configured to run on port 8009. Start the
service in the background and than start jConsole.
Create a Remote Connection using:

service:jmx:rmi:///jndi/rmi://localhost:8009/jmxrmi

Replace localhost with the actual machine name (or IP)

Once the connection is created you can open:

org.apache.uima
    ee.jms.service
        <Your Annotator Name> Uima EE Service
              Controller
                   Operations

Here you will find two buttons labeled:
          CompleteProcessingAndStop
          StopNow

CompleteProcessingAndStop will initiate quiesce

Regards, Jerry




On Thu, Oct 8, 2009 at 7:07 AM, Jörn Kottmann <ko...@gmail.com> wrote:

> Burn Lewis wrote:
>
>> We haven't been able to reproduce it ... probably depends on the version
>> of
>> Linux (or the JVM) ... the way nohup deals with stdin appears to vary.
>> Another change was published yesterday (check if bytes available before
>> reading) but if that doesn't fix it for you we'll have to catch
>> IOExceptions
>> from System.in ... since we can't test it would you mind adding a
>> try/catch
>> and verifying?
>>
>>
> Seems that it works now. Is there a way to quiesce a service
> with "q" when it is running in the background and redirecting
> its output to a file ?
>
> In my particular case its started like this:
>
> nohup bin/deployAsyncService.sh XXX/desc/Deploy_XXX.xml > console.out &
>
> Jörn
>

Re: UIMA AS java.io.IOException: Bad file descriptor when started in background on unix

Posted by Jörn Kottmann <ko...@gmail.com>.
Eddie Epstein wrote:
> Hi Jörn,
>
> Would probably need additional code in UIMA_Service: add a shutdown
> hook that would do the QUIESCE_AND_STOP.
>
>   
Is the shutdown hook executed when the process is killed
with kill pid ? If so we should add one.

Jörn

Re: UIMA AS java.io.IOException: Bad file descriptor when started in background on unix

Posted by Eddie Epstein <ea...@gmail.com>.
Hi Jörn,

Would probably need additional code in UIMA_Service: add a shutdown
hook that would do the QUIESCE_AND_STOP.

Eddie

On Thu, Oct 8, 2009 at 7:07 AM, Jörn Kottmann <ko...@gmail.com> wrote:
> Burn Lewis wrote:
>>
>> We haven't been able to reproduce it ... probably depends on the version
>> of
>> Linux (or the JVM) ... the way nohup deals with stdin appears to vary.
>> Another change was published yesterday (check if bytes available before
>> reading) but if that doesn't fix it for you we'll have to catch
>> IOExceptions
>> from System.in ... since we can't test it would you mind adding a
>> try/catch
>> and verifying?
>>
>
> Seems that it works now. Is there a way to quiesce a service
> with "q" when it is running in the background and redirecting
> its output to a file ?
>
> In my particular case its started like this:
> nohup bin/deployAsyncService.sh XXX/desc/Deploy_XXX.xml > console.out &
>
> Jörn
>

Re: UIMA AS java.io.IOException: Bad file descriptor when started in background on unix

Posted by Jörn Kottmann <ko...@gmail.com>.
Burn Lewis wrote:
> We haven't been able to reproduce it ... probably depends on the version of
> Linux (or the JVM) ... the way nohup deals with stdin appears to vary.
> Another change was published yesterday (check if bytes available before
> reading) but if that doesn't fix it for you we'll have to catch IOExceptions
> from System.in ... since we can't test it would you mind adding a try/catch
> and verifying?
>   
Seems that it works now. Is there a way to quiesce a service
with "q" when it is running in the background and redirecting
its output to a file ?

In my particular case its started like this:
nohup bin/deployAsyncService.sh XXX/desc/Deploy_XXX.xml > console.out &

Jörn

Re: UIMA AS java.io.IOException: Bad file descriptor when started in background on unix

Posted by Burn Lewis <bu...@gmail.com>.
Or perhaps explicit redirection for input from /dev/null will work.

-Burn

Re: UIMA AS java.io.IOException: Bad file descriptor when started in background on unix

Posted by Burn Lewis <bu...@gmail.com>.
We haven't been able to reproduce it ... probably depends on the version of
Linux (or the JVM) ... the way nohup deals with stdin appears to vary.
Another change was published yesterday (check if bytes available before
reading) but if that doesn't fix it for you we'll have to catch IOExceptions
from System.in ... since we can't test it would you mind adding a try/catch
and verifying?

- Burn.

Re: UIMA AS java.io.IOException: Bad file descriptor when started in background on unix

Posted by Jörn Kottmann <ko...@gmail.com>.
Burn Lewis wrote:
> Strange, we do this often.  Is there more info in the stack trace?  What
> level of UIMA-AS? Does it work without nohup?
>   
I am using the snapshot version from yesterday. Without
nohup the exception it not thrown.

BTW, I have seen the same stack trace in a comment in UIMA-1109.

Jörn


Re: UIMA AS java.io.IOException: Bad file descriptor when started in background on unix

Posted by Burn Lewis <bu...@gmail.com>.
Strange, we do this often.  Is there more info in the stack trace?  What
level of UIMA-AS? Does it work without nohup?

- Burn.