Bug #175

when calling lookup() after releasing objects: "SimonRemoteException: session was closed." or "SessionException: Cannot handle method call "Simon.lookup({...}, server)" while shutdown."

Added by hackie about 5 years ago. Updated about 5 years ago.

Status:ClosedStart date:10/23/2013
Priority:HighDue date:
Assignee:-% Done:

100%

Category:CoreSpent time:2.00 h
Target version:-

Description

The tutorials say, I have to release remote objects to ensure resources are freed. This doesn't always seem to work: From time to time, I get one of two exceptions (see below). I assume it's a thread problem with the reference counter since the problem happens more often when there is almost no code between the release() and the lookup(). It seems that after calling release() the client goes to some kind of shutdown mode and doesn't accept any further (new) objects. It doesn't even help the call createNameLookup() again.

Server call
one of:
$ java -cp lib/test/simon-1.1.1-jar-with-dependencies.jar:bin/ simon_bugtest.ServerMain
$ java -cp lib/test/simon-1.1.2-jar-with-dependencies.jar:bin/ simon_bugtest.ServerMain
$ java -cp lib/test/simon-1.1.3-jar-with-dependencies.jar:bin/ simon_bugtest.ServerMain
$ java -cp lib/test/simon-1.1.4-jar-with-dependencies.jar:bin/ simon_bugtest.ServerMain Client call
one of:
$ java -cp lib/test/simon-1.1.3-jar-with-dependencies.jar:bin/ simon_bugtest.ClientMain
$ java -cp lib/test/simon-1.1.4-jar-with-dependencies.jar:bin/ simon_bugtest.ClientMain
$ java -cp lib/test/simon-1.1.1-jar-with-dependencies.jar:bin/ simon_bugtest.ClientMain
$ java -cp lib/test/simon-1.1.2-jar-with-dependencies.jar:bin/ simon_bugtest.ClientMain Result

You find this two exceptions in all versions (see log below). When running in eclipse, they occur more often than when called from the console:

Exception in thread "main" de.root1.simon.exceptions.SimonRemoteException: session was closed. sessionid=0x00000003
at de.root1.simon.Dispatcher.interruptWaitingRequests(Dispatcher.java:761)
at de.root1.simon.Dispatcher.sessionClosed(Dispatcher.java:812)
at org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.sessionClosed(DefaultIoFilterChain.java:665)
at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextSessionClosed(DefaultIoFilterChain.java:395)
at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$900(DefaultIoFilterChain.java:46)
at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.sessionClosed(DefaultIoFilterChain.java:781)
at org.apache.mina.filter.codec.ProtocolCodecFilter.sessionClosed(ProtocolCodecFilter.java:387)
at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextSessionClosed(DefaultIoFilterChain.java:395)
at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$900(DefaultIoFilterChain.java:46)
at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.sessionClosed(DefaultIoFilterChain.java:781)
at org.apache.mina.core.filterchain.IoFilterAdapter.sessionClosed(IoFilterAdapter.java:95)
at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextSessionClosed(DefaultIoFilterChain.java:395)
at org.apache.mina.core.filterchain.DefaultIoFilterChain.fireSessionClosed(DefaultIoFilterChain.java:388)
at org.apache.mina.core.service.IoServiceListenerSupport.fireSessionDestroyed(IoServiceListenerSupport.java:244)
at org.apache.mina.core.polling.AbstractPollingIoProcessor.removeNow(AbstractPollingIoProcessor.java:580)
at org.apache.mina.core.polling.AbstractPollingIoProcessor.removeSessions(AbstractPollingIoProcessor.java:540)
at org.apache.mina.core.polling.AbstractPollingIoProcessor.access$600(AbstractPollingIoProcessor.java:67)
at org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.run(AbstractPollingIoProcessor.java:1087)
at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)

Exception in thread "main" de.root1.simon.exceptions.SessionException: Cannot handle method call "Simon.lookup({...}, server)" while shutdown.
at de.root1.simon.Dispatcher.checkForInvalidState(Dispatcher.java:657)
at de.root1.simon.Dispatcher.invokeNameLookup(Dispatcher.java:223)
at de.root1.simon.NameLookup.lookup(NameLookup.java:69)
at simon_bugtest.ClientMain.main(ClientMain.java:31)

(line numbers can be different to those in code. but it's always the second line of: "server = (ServerIntf) nameLookup.lookup("server");")

Expected result: * releasing an object and getting it again (or another one) should never be a problem. Environment:

$ java -version
java version "1.7.0_15"
Java(TM) SE Runtime Environment (build 1.7.0_15-b03)
Java HotSpot(TM) 64-Bit Server VM (build 23.7-b01, mixed mode)
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 13.04
Release: 13.04
Codename: raring
$ uname -a
Linux 3.8.0-32-generic #47-Ubuntu SMP Tue Oct 1 22:35:23 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

testlog.txt Magnifier - Complete protocol of my tests (67.8 KB) hackie, 10/23/2013 01:30 AM

testcode.tgz - source code to reproduce the problem, simplified as much as possible (946 Bytes) hackie, 10/23/2013 01:30 AM

Associated revisions

Revision 682
Added by achristian about 5 years ago

fixed issue #175
added additional flag to Dispatcher to determin in sessionClosed() if the shutdown was triggered by release() of by session error

Revision 683
Added by achristian about 5 years ago

fixed issue #175
reverted last changes and went for solution of issue #130 where this issue already has been fixed.

History

#1 Updated by achristian about 5 years ago

  • Target version set to 1.2.0

#2 Updated by achristian about 5 years ago

Thanks for reporting this issue. I will look into it.

#3 Updated by achristian about 5 years ago

I'm not really able to reproduce the described behavior.

Since end of 2009, there's a JUnit test which does almost the same, with one exception: It does call a simple remote methode between the lookup and release.

I will further look into the issue.

#4 Updated by achristian about 5 years ago

Now I was able to reproduce it.
Running test-code in Netbeans does not bring up the exception. Running on console with SIMON 1.2.0-SNAPSHOT does also not bring up the exception.

But running in console with 1.1.4 shows sometimes the exception. Now I will debug it...

#5 Updated by achristian about 5 years ago

  • Category changed from unknown to Core
  • Status changed from New to Closed
  • Target version deleted (1.2.0)
  • % Done changed from 0 to 100

Finally, found out that this has been solved in #130 .. but only for 1.2.0-SNAPSHOT.

Adapted the fix now also for 1.1.5-SNAPSHOT

#7 Updated by hackie about 5 years ago

Thank you. Seems I haven't looked good enough in this bug tracker :-/

The new version works fine for me. And 1.2.0 too

#8 Updated by achristian about 5 years ago

Please keep in mind that "-SNAPSHOT" versions are considered as "still in development"-versions. They are not yet final and not yet 100% stable (but they are well tested and >=99% stable).

#9 Updated by hackie about 5 years ago

I know. But with this bug fixed is is much more stable on my maching than the latest 'stable' release. Thanks for your fast answer and for this nice library.

Also available in: Atom PDF