[JBoss JIRA] Created: (JBREM-857) transporterclient not thread-safe for failover
by craig bordelon (JIRA)
transporterclient not thread-safe for failover
----------------------------------------------
Key: JBREM-857
URL: http://jira.jboss.com/jira/browse/JBREM-857
Project: JBoss Remoting
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: transporter
Affects Versions: 1.4.6.GA
Environment: solaris 10 and java 5
Reporter: craig bordelon
Fix For: 2.2.2.GA_CP02
the jboss 1.4.1 transporterclient used by multithreaded program was giving strange results on a clustered server when failing over so i found lack of synchronization in the code.
I made these changes and seems to be helping.
changes to TransporterClient.java.
I would like this fixed in the 2.x and 3.x versions (hello developers). I think i know how to fix the 2.x version of this code too as it has some new stuff but is likewise broken. (developers send me an email to bord(a)iscp.telcordia.com if you need it. thx
Craig)
@@ -93,11 +93,12 @@
/**
* Disconnects the remoting client
*/
- private void disconnect()
+ private synchronized void disconnect()
{
if(remotingClient != null)
{
remotingClient.disconnect();
+ remotingClient = null;
}
}
@@ -232,14 +233,18 @@
do
{
+ Client rcl = null;
+ synchronized(this) { rcl = remotingClient; }
+ if (rcl == null) throw new CannotConnectException("Client has been dis
connected.");
try
{
failOver = false;
- response = remotingClient.invoke(request);
+ response = rcl.invoke(request);
}
catch(CannotConnectException cnc)
{
- failOver = findAlternativeTarget();
+ failOver = findAlternativeTarget(rcl);
+ if (log.isDebugEnabled()) log.error("on CannotConnectException failO
ver is "+failOver+" for "+rcl.getInvoker().getLocator());
if(!failOver)
{
throw cnc;
@@ -264,7 +269,7 @@
*
* @return
*/
- private boolean findAlternativeTarget()
+ private boolean findAlternativeTarget(Client rcl)
{
boolean failover = false;
@@ -287,12 +292,19 @@
{
// finally found server with target handler
InvokerLocator newLocator = data.getInvokerLocator();
- if(!remotingClient.getInvoker().getLocator().equals(new
Locator))
+ if(!rcl.getInvoker().getLocator().equals(newLocator))
{
try
{
- remotingClient = new Client(newLocator);
- remotingClient.connect();
+ synchronized(this) {
+ if (rcl == remotingClient) {
+ disconnect();
+ remotingClient = new Client(newLocator);
+ }
+ //otherwise have to assume some other thread
+ //has meanwhile changed it
+ //including even disconnecting
+ }
return true;
}
catch(Exception e)
@@ -300,6 +312,8 @@
log.warn("Problem connecting to newly found alter
nate target.", e);
}
}
+ else if (log.isDebugEnabled())
+ log.error(rcl.getInvoker().getLocator()+" == "+newLoc
ator);
}
}
}
@@ -333,4 +347,4 @@
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 1 month
[JBoss JIRA] Created: (JBREM-906) NoSuchObjectException on Server Restart Using RMI Transport & Unified Invoker
by John Reynolds (JIRA)
NoSuchObjectException on Server Restart Using RMI Transport & Unified Invoker
-----------------------------------------------------------------------------
Key: JBREM-906
URL: http://jira.jboss.com/jira/browse/JBREM-906
Project: JBoss Remoting
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: unifiedinvoker
Affects Versions: 2.2.2.GA
Environment: Server Running Windows XP or Redhat - Swing Client on Windows XP
Reporter: John Reynolds
Using a Swing client to connect to the JBoss server, configured with RMI Transport Connector and Unified Invoker, I receive the following StackTrace when, after successfully connecting to the server and executing a few EJB transactions, I shut the server down and then bring it back up. Upon attempting to do any further invocations, it appears cached information is causing the client to fail.
-------------
(rmi.RMIClientInvoker 272 ) java.rmi.NoSuchObjectException: no such object in table
galaxy.framework.model.domain.services.util.SLCommunicationException: Error making invocation in RMI client invoker.
at galaxy.framework.model.domain.services.util.ServiceLocator.authenticateUser(ServiceLocator.java:738)
at galaxy.framework.model.domain.services.util.ServiceLocator.initializeWithLDAP(ServiceLocator.java:435)
at galaxy.application.view.swing.presentation.util.ClientConnectionManager$1.run(ClientConnectionManager.java:51)
Caused by: org.jboss.remoting.CannotConnectException: Error making invocation in RMI client invoker.
at org.jboss.remoting.transport.rmi.RMIClientInvoker.transport(RMIClientInvoker.java:273)
at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:122)
at org.jboss.remoting.Client.invoke(Client.java:1550)
at org.jboss.remoting.Client.invoke(Client.java:530)
at org.jboss.invocation.unified.interfaces.UnifiedInvokerProxy.invoke(UnifiedInvokerProxy.java:183)
at org.jboss.invocation.InvokerInterceptor.invokeInvoker(InvokerInterceptor.java:365)
at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:197)
at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:61)
at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:70)
at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:112)
at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:100)
at $Proxy1.authenticateSwingUserWithLDAP(Unknown Source)
at galaxy.framework.model.domain.services.util.ServiceLocator.authenticateUser(ServiceLocator.java:725)
... 2 more
Caused by: java.rmi.NoSuchObjectException: no such object in table
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:126)
at org.jboss.remoting.transport.rmi.RMIServerInvoker_Stub.transport(Unknown Source)
at org.jboss.remoting.transport.rmi.RMIClientInvoker.transport(RMIClientInvoker.java:238)
... 14 more
------------
Seems potentially similar to this issue fixed in 4.0.5 in non-remoting-RMI code:
http://www.jboss.com/index.html?module=bb&op=viewtopic&t=116027
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 1 month
[JBoss JIRA] Created: (JBREM-808) Remove dependencies on ObjectNameFactory from JBoss JMX
by Julien Viet (JIRA)
Remove dependencies on ObjectNameFactory from JBoss JMX
-------------------------------------------------------
Key: JBREM-808
URL: http://jira.jboss.com/jira/browse/JBREM-808
Project: JBoss Remoting
Issue Type: Task
Security Level: Public (Everyone can see)
Reporter: Julien Viet
It happens when my POJO has not been bound on the transporter server, it looks like the transporter client is trying to do some fail over.
This make JBoss Remoting depends on the JBoss JMX implementation. That makes JBoss Remoting more difficult to embed and reuse.
I think that the ObjectNameFactory class could be easily ported to JBoss Remoting without any harm done. However perhaps JBoss Remoting has more dependencies on JBoss JMX that I don't know that would prevent to remove such dependency.
[junit_] Exception in thread "main" java.lang.NoClassDefFoundError: org/jboss/mx/util/ObjectNameFactory
[junit_] at org.jboss.remoting.transporter.InternalTransporterServices.<clinit>(InternalTransporterServices.java:41)
[junit_] at org.jboss.remoting.transporter.TransporterClient.findAlternativeTarget(TransporterClient.java:330)
[junit_] at org.jboss.remoting.transporter.TransporterClient.invoke(TransporterClient.java:301)
[junit_] at $Proxy0.getInfo(Unknown Source)
[junit_] at org.jboss.portal.test.framework.driver.remote.RemoteTestDriverClient.getInfo(RemoteTestDriverClient.java:107)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 1 month
[JBoss JIRA] Created: (JBREM-762) Deadlock bug in socket invoker
by Tim McCune (JIRA)
Deadlock bug in socket invoker
------------------------------
Key: JBREM-762
URL: http://jira.jboss.com/jira/browse/JBREM-762
Project: JBoss Remoting
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: transport
Affects Versions: 1.4.6.GA
Environment: JBoss 4.0.4 EJB 3.0-rc9-patch1 JDK 1.6.0
Reporter: Tim McCune
There is a potential thread leak in ServerThread.java that causes ServerThreads to stick around, but to disappear from the thread pool as the accept() thread(s) see it. Eventually, when the # of leaked threads reaches the MaxPoolSize, the system ends up deadlocked and will not accept any more incoming socket connections. I have described the problem in great detail in a forum post and in support case 00016786. I have patched the code, and so far it seems to be working fine and to have fixed the problem. This is what I patched:
In ServerThread.java, I wrapped the contents of wakeup() inside of a try/catch, block, with the following code in the catch block:
} catch (Exception e) {
synchronized (clientpool) {
synchronized (threadpool) {
clientpool.remove(this);
threadpool.add(this);
Thread.interrupted();
}
}
throw e;
}
This makes sure that the thread is put back into the threadpool when an exception occurs in the createServerSocket() method (this method is doing socket I/O in 1.4.6, and in our case, this socket connection was timing out.).
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 1 month
[JBoss JIRA] Created: (JBREM-652) allow passing of config map when creating transporter client
by Tom Elrod (JIRA)
allow passing of config map when creating transporter client
------------------------------------------------------------
Key: JBREM-652
URL: http://jira.jboss.com/jira/browse/JBREM-652
Project: JBoss Remoting
Issue Type: Task
Security Level: Public (Everyone can see)
Components: transporter
Affects Versions: 2.2.0.Alpha4
Reporter: Tom Elrod
Assigned To: Tom Elrod
Fix For: 2.2.0.Beta1 (Bluto)
Currently the transporter client can only be created using invoker locator for configuration. Need to add to the api so can pass config map which gets passed to the remoting client that is created so can customize things such as ssl config. For example, would be need to be able to something like is done in org.jboss.test.remoting.transport.socket.ssl.custom.InvokerClientTest with a transporter client.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 1 month
[JBoss JIRA] Created: (JBREM-738) ServerThread/invoker still executing invocation after its related TransportServer was stopped
by craig bordelon (JIRA)
ServerThread/invoker still executing invocation after its related TransportServer was stopped
---------------------------------------------------------------------------------------------
Key: JBREM-738
URL: http://jira.jboss.com/jira/browse/JBREM-738
Project: JBoss Remoting
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: transporter
Affects Versions: 2.2.0.Beta1 (Bluto)
Environment: java 1.5 on solaris but doubt its specific to this one.
Reporter: craig bordelon
Assigned To: Tom Elrod
get an exception on the third iteration of a transporter client to a transporter server where the client code is doing the same invoke each time. This should not happen as the first two iterations give correct result. The exception is thrown from the server side as apparently the jboss remoting internals are confused -- stating that a ServerInvoker is not in "started state".
Exception is
java.lang.reflect.UndeclaredThrowableException
at $Proxy4.toString(Unknown Source)
at java.lang.String.valueOf(String.java:2615)
at java.lang.StringBuilder.append(StringBuilder.java:116)
at proxy.Client.testClientCall(Client.java:38)
at proxy.Client.main(Client.java:115)
Caused by: org.jboss.remoting.ServerInvoker$InvalidStateException: Can not proc
ess invocation request since is not in started state.
at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:751)
at org.jboss.remoting.transport.socket.ServerThread.processInvocation(S
erverThread.java:568)
at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.
java:390)
at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.ja
va:164)
at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClient
Invoker.java:163)
at org.jboss.remoting.Client.invoke(Client.java:1548)
at org.jboss.remoting.Client.invoke(Client.java:534)
at org.jboss.remoting.Client.invoke(Client.java:522)
at org.jboss.remoting.transporter.TransporterClient.invoke(TransporterC
lient.java:297)
to reproduce this (one way at least):
run the transporter sample modified for the Client to execute the the makeClientCall multiple times.
Now
to get past the obvious first issue (socket in use) add new code for
customerProcessor.releaseCustomer(processedCustomer.getCustomerId()
in the Client just before the
TransporterClient.destroyTransporterClient(customerProcessor);
Implement this method in the CustomerProcessorImpl to use the id to locate (eg hash get()) the related ICustomer TransporterClient and destroy it and to the TransporterServer to stop it.
This theoretically frees up the Customer "server" allowing for the next iteration by the Client.
note that the processCustomer() implemenation is modified to store the TransporterClient and TransporterServer that are created here.
------------
I dug into the code a bit and what i gathered is that a ServerThread is trying to do processInvocation using a SocketServerInvoker that was already "stopped". I think the ServerThread itself should not be executing as the TransporterServer it should be involved with was already stopped.
I posted to the jboss forum on issues i was having trying to make the transporter sample run from the client multiple times. See issue by "bord" on 4/17/2007
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 1 month
[JBoss JIRA] Created: (JBREM-591) Make asynchronous calls using Transporter
by vivek v (JIRA)
Make asynchronous calls using Transporter
-----------------------------------------
Key: JBREM-591
URL: http://jira.jboss.com/jira/browse/JBREM-591
Project: JBoss Remoting
Issue Type: Feature Request
Security Level: Public (Everyone can see)
Components: transporter
Reporter: vivek v
Assigned To: Tom Elrod
This came out of the user forum question,
http://www.jboss.com/index.html?module=bb&op=viewtopic&t=89224
Currently, there is a mechanism to do asynchronous calls and callbacks using InvocationHandler. As more and more people are using POJOs (via Transporter) for remoting it would be great if we can have the same features (both asynchronous calls and callbacks) available for the Transporter.
Couple of use cases can be,
Asynchronous Call
-----------------------------
1) Client makes a simple method call (using POJO) on server
2) Server gets the request and returns immediately to the Client. Now Client is free to do its own stuff without waiting or polling for the result.
3) Server starts processing the request
4) When the response is ready Server sends the response to the Client.
Callbacks
--------------------
1) An alert happens on the server side
2) Server should be able to send the alert to the Client without Client requesting for it.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 1 month