IV19713: java.nio.channels.Selector.select(long) in tight loop with zero selected keys in Linux

Subscribe to this APAR

By subscribing, you receive periodic emails alerting you to the status of the APAR, along with a link to the fix after it becomes available. You can track this item individually or track all items by product.

Notify me when this APAR changes.

Notify me when an APAR for this component changes.

APAR status

  • Closed as program error.

Error description

  • Error Message: N/A
    .
    Stack Trace: N/A
    .
    The application observe a tight loop in the select() method of
    Selector class which continues till the channels are explicitly
    cancelled by the application.
    

Local fix

  • Monitor for select() method of Selector class returns with zero
    selected keys and cancel the channels through application if it
    exceeds the expected limit.
    

Problem summary

  • The root cause of the issue is that there is a very small timing
    window between a channel set to close (not open) in the Java
    layer and the actual close of the channel in the native layer.
    Hence, if the interestOps is set to 0 for that channel by the
    application during this timing window, the selector presumes
    that the channel is already closed and do not try to delete the
    channel from the select operation. Hence, it will result in a
    situation that on Java side, the interest ops is not selected
    whereas on the native side the previous interested operation is
    still selected. If the interested operation is ready on the
    native side for that channel, then the polling for that channel
    immediately returns. As the selected operation is no more
    interested in the Java layer, the application invoke the
    select() again without clearing the data from the channel. In
    the meantime, the other thread which tries to close the channel
    is waiting for the selector lock to cancel the key. As the
    select() operation immediately returns from the native side
    polling results in a tight loop, the selector lock is not
    released. Hence, the channel is not able to close which result
    in an infinite loop in select() method.
    

Problem conclusion

  • This defect will be fixed in:
    6.0.0 SR11
    6.0.1 SR3
    7.0.0 SR2
    .
    The JVM is updated to ensure that the channels are deleted from
    the select operation when interestOps is set to zero
    irrespective of whether the channel is in close processing or
    not.
    

Temporary fix

Comments

APAR Information

  • APAR number

    IV19713

  • Reported component name

    JAVA CLASS LIBS

  • Reported component ID

    620700130

  • Reported release

    600

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2012-04-14

  • Closed date

    2012-05-04

  • Last modified date

    2012-05-04

  • APAR is sysrouted FROM one or more of the following:

  • APAR is sysrouted TO one or more of the following:

Fix information

  • Fixed component name

    JAVA CLASS LIBS

  • Fixed component ID

    620700130

Applicable component levels

  • R600 PSY

       UP

  • R700 PSY

       UP



Rate this page:

(0 users)Average rating

Add comments

Document information


More support for:

Runtimes for Java Technology
Java Class Libraries

Software version:

6.0

Reference #:

IV19713

Modified date:

2012-05-04

Translate my page

Machine Translation

Content navigation