You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have to modules (different threads) accessing restlet api in my java application. The first module uses the ClientResource and connects to a remte server. The other acts as a restserver using new Component() waiting for requests.....
The modules starts about at the same time. Once a while i experience a "freeze" in the startup of the modules. And the stacktrace shows this every time it hangs:
Module 1: #46 daemon prio=5 os_prio=0 tid=0x15e72000 nid=0x3444 waiting for monitor entry [0x1684f000] java.lang.Thread.State: BLOCKED (on object monitor) at org.restlet.engine.Engine.getInstance(Engine.java:249) - waiting to lock <0x09938838> (a java.lang.Class for org.restlet.engine.Engine) at org.restlet.data.Method.<clinit>(Method.java:337) at org.restlet.resource.ClientResource.<init>(ClientResource.java:396)
Module2: #50 daemon prio=5 os_prio=0 tid=0x15e6f400 nid=0x3774 in Object.wait() [0x167bf000] java.lang.Thread.State: RUNNABLE at org.restlet.engine.connector.HttpProtocolHelper.registerMethods(HttpProtocolHelper.java:39) at org.restlet.engine.connector.ProtocolHelper.<init>(ProtocolHelper.java:42) at org.restlet.engine.connector.HttpProtocolHelper.<init>(HttpProtocolHelper.java:35) at org.restlet.engine.Engine.registerDefaultProtocols(Engine.java:867) at org.restlet.engine.Engine.discoverProtocols(Engine.java:680) at org.restlet.engine.Engine.<init>(Engine.java:492) at org.restlet.engine.Engine.register(Engine.java:382) - locked <0x09938838> (a java.lang.Class for org.restlet.engine.Engine) at org.restlet.engine.Engine.register(Engine.java:368) - locked <0x09938838> (a java.lang.Class for org.restlet.engine.Engine) at org.restlet.engine.Engine.getInstance(Engine.java:252) - locked <0x09938838> (a java.lang.Class for org.restlet.engine.Engine) at org.restlet.Restlet.<init>(Restlet.java:122) at org.restlet.Restlet.<init>(Restlet.java:99) at org.restlet.Component.<init>(Component.java:173)
The first thread is waiting for the second in a blocked state. It looks to me that the second thread is causing the blocking, but i'm not clear on why the second thread never releases the monitor
Activity
Tembrel commentedon Aug 10, 2020
What Restlet version is this? I see some problems with the most recent code, but I don't see an
Object.waitinHttpProtocolHelper.registerMethods.To work around this, call
Engine.getInstancein each thread before calling any other Restlet methods.Restlet folks: Probably best not to use
static synchronizedto guard access to the singleton. Also, the call to an abstract method in the constructor ofProtocolHelperlooks a bit dicey.cyberquarks commentedon Mar 25, 2021