Hi,

I have another question related to my recent post about trying to re-establish lost connections. Recall that my system is set up without automatic reconnect, but may do a "manual reconnect" via

  qpid::Messaging connection(url);

  ...

  if(!connection.isOpen()) {
    connection.open();
  }

and that this is sometimes triggered by an "internal disconnect" accompanied by an exception with message "Failed to connect (reconnect disabled)".

Now, I just found that some of the reconnects are accompanied by a "Session detached by peer" exception. I'm struggling a bit to find out what exactly triggers this; the problems occur once every few hours at a remote site, and I can't just start or stop or update the software at any old time, so it's a bit hard to debug...

My question is: Is there a chance that the above open() might trigger this exception as it tries to re-establish a session that was there before the disconnect? If that's the case, is there a way I can avoid getting into the situation? Would it help to do something like

if(session.isValid() && session.hasError()) {
  session.close();
}

first? (Where "session" represents the session associated with "connection" - there is one at the most.)

Thanks,

- Toralf

Reply via email to