IBM Support

PH02744: ORG.OSGI.FRAMEWORK.SERVICEEXCEPTION: THE USE COUNT FOR THE SERVICE OVERFLOWED WHEN CREATING A JAVAX.NAMING.INITIALCONTEXT

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

  • If applications frequently create new
    javax.naming.InitialContext objects and do not close the
    resultant Context objects then eventually subsequent attempts
    to create more InitialContext objects will fail with a
    org.osgi.framework.ServiceException: The use count for the
    service overflowed.
    
    
    An example callstack is shown below:
    
    [8/21/18 16:17:15:829 CEST] 000000ff BusinessExcep E  CNTR0020E:
    EJB threw an unexpected (non-declared) exception during
    invocation of method "myTestMetohd" on bean
    "BeanId(myTestBean#Test.jar#myImpl, null)". Exception data:
    org.osgi.framework.ServiceException: The use count for the
    service overflowed.
    at
    org.eclipse.osgi.internal.serviceregistry.ServiceUse.getService(
    ServiceUse.java:117)
    at
    org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImp
    l.getService(ServiceRegistrationImpl.java:468)
    at
    org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.getSer
    vice(ServiceRegistry.java:467)
    at
    org.eclipse.osgi.framework.internal.core.BundleContextImpl.getSe
    rvice(BundleContextImpl.java:594)
    at org.apache.aries.jndi.Utils$4.run(Utils.java:195)
    at
    java.security.AccessController.doPrivileged(AccessController.jav
    a:594)
    at
    org.apache.aries.jndi.Utils.getServicePrivileged(Utils.java:193)
    at
    org.apache.aries.jndi.ContextHelper.getInitialContextUsingBuilde
    r(ContextHelper.java:231)
    at
    org.apache.aries.jndi.ContextHelper.getContextProvider(ContextHe
    lper.java:208)
    at
    org.apache.aries.jndi.ContextHelper.getInitialContext(ContextHel
    per.java:141)
    at
    org.apache.aries.jndi.OSGiInitialContextFactoryBuilder.getInitia
    lContext(OSGiInitialContextFactoryBuilder.java:51)
    at
    javax.naming.spi.NamingManager.getInitialContext(NamingManager.j
    ava:695)
    at
    javax.naming.InitialContext.getDefaultInitCtx(InitialContext.jav
    a:324)
    at javax.naming.InitialContext.init(InitialContext.java:255)
    .
    .
    Caused by: org.osgi.framework.ServiceException: The use count
    for the service overflowed.
    at
    org.eclipse.osgi.internal.serviceregistry.ServiceUse.getService(
    ServiceUse.java:117)
    at
    org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImp
    l.getService(ServiceRegistrationImpl.java:468)
    at
    org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.getSer
    vice(ServiceRegistry.java:467)
    at
    org.eclipse.osgi.framework.internal.core.BundleContextImpl.getSe
    rvice(BundleContextImpl.java:594)
    at org.apache.aries.jndi.Utils$4.run(Utils.java:195)
    at
    java.security.AccessController.doPrivileged(AccessController.jav
    a:594)
    at
    org.apache.aries.jndi.Utils.getServicePrivileged(Utils.java:193)
    at
    org.apache.aries.jndi.ContextHelper.getInitialContextUsingBuilde
    r(ContextHelper.java:231)
    

Local fix

Problem summary

  • ****************************************************************
    * USERS AFFECTED:  All users of IBM WebSphere Application      *
    *                  Server                                      *
    ****************************************************************
    * PROBLEM DESCRIPTION: org.osgi.framework.ServiceException:    *
    *                      The use count for the                   *
    *                      service overflowed is thrown when       *
    *                      creating an InitialContext.             *
    ****************************************************************
    * RECOMMENDATION:                                              *
    ****************************************************************
    JNDI support in WebSphere Application Server is integrated with
    the JNDI service of the underlying OSGi framework.  When a
    naming Context is created a new OSGi service reference is
    created to the OSGi JNDI service.  If the application does not
    close the Context then the service reference is not correctly
    cleaned up and the service reference count, an integer in the
    underlying Equinox framework, is not decremented.
    Eventually the service reference count can reach
    Interger.MAX_VALUE.  Subsequent requests for a new naming
    Context fail with
    org.osgi.framework.ServiceException: The use count for the
    service overflowed.
    

Problem conclusion

  • A number of issues were backported from Apache Aries, including
    Apache Aries JIRA ARIES-1068 that replaced the mechanism by
    which each new Context resulted in the creation of a new
    service reference with a mechanism that employed a
    ServiceTracker and a cache of service references that is not
    dependent on the naming Context objects being closed.  The
    mechanism is also more performant than creating a new
    ServiceReference for each new naming Context.
    
    The fix for this APAR is targeted for inclusion in fix pack
    9.0.5.10. For more information, see 'Recommended Updates for
    WebSphere Application Server':
    https://www.ibm.com/support/pages/node/715553
    

Temporary fix

Comments

APAR Information

  • APAR number

    PH02744

  • Reported component name

    WEBS APP SERV N

  • Reported component ID

    5724H8800

  • Reported release

    900

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt / Xsystem

  • Submitted date

    2018-09-13

  • Closed date

    2021-10-08

  • Last modified date

    2021-10-08

  • 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

    WEBS APP SERV N

  • Fixed component ID

    5724H8800

Applicable component levels

  • R900 PSY

       UP

[{"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Product":{"code":"SSEQTP","label":"WebSphere Application Server"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"9.0","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
02 November 2021