Page 1 of 1

Unhandled Exception: System.InvalidOperationException: Pushing object second time.

Posted: Wed 22 Aug 2012 04:09
by andyscott12
Hi,

I am importing a bunch of flat files into MySQL using dotConnect for MySQL and I seem to hit this error ? It doesn't seem to be anything in my code but rather something in dotConnect ? I am using v7.1.40.0

Code: Select all

Unhandled Exception: System.InvalidOperationException: Pushing object second time.
at Devart.Common.DbConnectionInternal.d(Object A_0)
at Devart.Common.DbConnectionPoolGroup.a(DbConnectionPool A_0)
at Devart.Common.DbConnectionPoolGroup.a(Object A_0)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionCo
ntext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, C
ontextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.TimerQueueTimer.CallCallback()
at System.Threading.TimerQueueTimer.Fire()
at System.Threading.TimerQueue.FireNextTimers()

Re: Unhandled Exception: System.InvalidOperationException: Pushing object second time.

Posted: Wed 22 Aug 2012 12:08
by Pinturiccio
There is not enough information for reproducing the issue. If it is possible, create and send us a small test project with the corresponding DDL/DML scripts for reproducing the issue. Please also describe the steps for reproducing the issue.

Re: Unhandled Exception: System.InvalidOperationException: Pushing object second time.

Posted: Wed 22 Aug 2012 13:28
by andyscott12
Hi,

Unfortunately it's a bit hard to send a test project because its part of a larger project. I think maybe when I was importing a flat file the CPU load was too high OR was not enough memory (and so this caused big pressure on the Garbage Collector) and so DevArt hit a bug where it didn't know exactly what to do ?

The flat file had a few million lines of data and hit it mid way through - so im a bit unsure what exactly caused it and the log only spat out the error i've pasted.

Re: Unhandled Exception: System.InvalidOperationException: Pushing object second time.

Posted: Thu 19 Sep 2013 12:37
by BGrojer
Is this issue solved or happend again to you AndyScott?

Re: Unhandled Exception: System.InvalidOperationException: Pushing object second time.

Posted: Fri 03 Jul 2015 08:32
by bpipe
We are having same Exception using PostgreSQL driver.
System.InvalidOperationException: Pushing object second time. at Devart.Common.DbConnectionInternal.d(Object A_0) at Devart.Common.DbConnectionPoolGroup.a(DbConnectionPool A_0) at Devart.Common.DbConnectionPoolGroup.a(Object A_0) at System.Threading._TimerCallback.TimerCallback_Context(Object state) at System.Threading.ExecutionContext.runTryCode(Object userData) at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx) at System.Threading._TimerCallback.PerformTimerCallback(Object state)

Re: Unhandled Exception: System.InvalidOperationException: Pushing object second time.

Posted: Mon 06 Jul 2015 14:11
by Pinturiccio
Is the issue reproduced with the latest version of dotConnect for MySQL? You can download the latest trial version of dotConnect for MySQL from our site http://www.devart.com/dotconnect/mysql/download.html

Please create and send us a small test project with the corresponding DDL/DML scripts for reproducing the issue. Please also describe the steps for reproducing the issue.

Please also note that dotConnect for MySQL is not thread safe, so you should use a separate connection for each thread or synchronize the threads yourself.

Re: Unhandled Exception: System.InvalidOperationException: Pushing object second time.

Posted: Mon 20 Jul 2015 12:21
by bpipe
Pinturiccio wrote:Is the issue reproduced with the latest version of dotConnect for MySQL?.
This error is not related to particular driver, it effects all your code (products) which are based on common 'Devart.Common.DbConnectionInternal' class.

Re: Unhandled Exception: System.InvalidOperationException: Pushing object second time.

Posted: Wed 22 Jul 2015 10:31
by Pinturiccio
Please provide us with the following information:
1. A version of dotConnect for PostgreSQL;
2. Is your application multithreaded?
3. Does the exception occur each time, or just from time to time?

If possible, please send us a snippet of code, which can help us to reproduce the issue. A test project will be appreciated.

Re: Unhandled Exception: System.InvalidOperationException: Pushing object second time.

Posted: Fri 07 Aug 2015 12:40
by bpipe
1. Driver version: Devart.Data.PostgreSql, Version=7.3.215.0
2. Our system is multithreaded
3. It very rare exception, we have seen it only 1 time, during 6 months, of running 24\7.

I doubt it could be repeatedly reproduced, if only after understanding a bug in code, and writing specific test case code, which will probably make havy use of thread synchronization primitives.

I have took a quick look at your disassembled source code, and I have a guess that the problem could be here:

Code: Select all

DbConnectionPoolGroup.cs
    private void a(DbConnectionPool A_0)
    {
...
          DbConnectionInternal connectionInternal = (DbConnectionInternal) arrayList1[index];
          if (connectionInternal.[b]IsEmancipated[/b]) 
The outcome of this check depend on DbConnectionInternal.i value, and the next statement: connectionInternal.d(...) throws "PushingObjectSecondTime" depending on same DbConnectionInternal.i value, my guess the value changed between those lines by other thread, though you use Monitor in this method, there must be other places in code that modify DbConnectionInternal.i

Code: Select all

          {
            connectionInternal.d((object) null);

Re: Unhandled Exception: System.InvalidOperationException: Pushing object second time.

Posted: Tue 11 Aug 2015 12:26
by Pinturiccio
Thank you for the provided information. The required locks are executed in the code you described. However, we found potential problems in two places and fixed them. It might fix the issue. We will post here when the corresponding build of dotConnect for PostgreSQL is available for download.