Hi,
according to log, you have issue with CloudEnabledDBService and not GenericDBService.
btw, Officinall.BaseClasses.SQLLogger is usual class or also service ?
Hi,
according to log, you have issue with CloudEnabledDBService and not GenericDBService.
btw, Officinall.BaseClasses.SQLLogger is usual class or also service ?
Okay, I will add both handlers that log
The instance of the pooled RO service is in a state where all subsequent calls return the same error.
This service is a TCP channel (internal LAN clients only)
Breakpoints aren’t really possible: Our service works for 500 servers for several days/months. Only the occasional error which appears to then require a service (process) restart to fix the issue.
Our IpTcpServerChannel does not appear to have an InvokeMethod event.
Could Deactivate be called at a wrong moment? What triggers Deactivate?
Normally Deactivate shokld only be called after a successful call,before the instance is returned to the pool.
As a quick test: does this issue disappear if you change from the Pooled class factory to the “standard” one – which iirc creates a fresh instance every time? obviosuly not ideal for performance, bbut it might help us narrow this down further…
if the standardc one still fails, it means your service doesnt get activated at all (for some reason); if it doesn’t, it could mean maybe “bad” instance go back to the pool somehow…
But really, Activate should (by design) automatically be called every time an instance gets a call, always…
By the way: Our service lives in a .dll which is referenced by the RO windows service .exe.
The service is added explicitely to the ApplicationServer object.
Shouldn’t be relaed but maybe some freak windows external event does something with dlls
FYI: I have been investigating logs of clients in the past.
The issue also can occur for other services (in the .exe itself)
The issue also occurs for the same service which is hosted in another process which uses a RO HTTP channel.
Hi,
you said
but according to log, it calls InternalGetSession.
btw, Officinall.BaseClasses.SQLLogger is usual class or service ?
I would not expect that to make any diffrence.
I think that might be the issue here, yes! What does LogDatabaseCommand look like and do?
That said, @EvgenyK, iirc we (should) activate every service call, whether it requires a sesion or not, no? Im guessing the error is misleading, and acctually means “theres no session”…
private ISession InternalGetSession(Boolean throwException)
{
if (!this.IsActive)
{
throw new ServiceInstanceNotActiveException();
}
IsActive is set to true (unconditionally) at the very end of Activating the service…
Can i see the rest of that callstack, jic, to see what comes before ServerChannel.InvokeMethod?
The SQLLogger is some code of ours that has the purpose of saving all SQL queries.
It logs to a file and/or memory.
It does not contain RO calls except I try to add some metadata to the log.
The code looks in the session data for this metadata.
It looks like accessing the Session data is what causes the issue.
Hi,
Looks like you address to deactivated service so you have this exception.
You can avoid that error with code like
private string GetSessionValue(string key)
{
if (!daSvc_.IsActive) return "";
...
but better to add BeforeDeactivate or AfterDeactivate event to daSvc_ service.
here you can raise exception and review callstack if this case shouldn’t be happened.
FYI: The daSvc_ is the service itself
public class OffBaseDataAbstractService : DataAbstractService, IROServiceStatistics, IDisposable
…
public OffBaseDataAbstractService(ISessionManager sessionManager, IEventSinkManager eventManager, bool bLogService=true) // FVC: This constructor signature is in the base class DataAbstractService (and gets called by RO?)
: base(sessionManager, eventManager)
{
…
sqlloggger_ = new SQLLogger(this, sqllogitfbase);
…
}
I do not understand your “but better to add BeforeDeactivate or AfterDeactivate event to daSvc_ service.” suggestion.
Do you mean add logging there to investigate the problem?
Hi,
Do you mean add logging there to investigate the problem?
Yes.
You have a case when some code calls Deactivate (or IActivatableService.Deactivate) so you have situation when daSvc_.IsActive = false and it causes this issue with accessing to session’s value.
I suggest to review callstack so we will know what code causes this issue.
looks like this is some kind of corner case because it happens sporadically.
FYI: I have no Deactivate in my code.
Logging all beforedeactivate & afterdeactivate with full call stack will be a bit CPU & log heavy I fear.
For now I log all events & I also have put the safety in my GetSessionValue
The code looks in the session data for this metadata.
Yes, but your service is set to not require a session, so it might not have one ;). Thats what causing the error.