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

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for MySQL
Post Reply
andyscott12
Posts: 6
Joined: Tue 01 Feb 2011 04:19

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

Post by andyscott12 » Wed 22 Aug 2012 04:09

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()

Pinturiccio
Devart Team
Posts: 2420
Joined: Wed 02 Nov 2011 09:44

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

Post by Pinturiccio » Wed 22 Aug 2012 12:08

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.

andyscott12
Posts: 6
Joined: Tue 01 Feb 2011 04:19

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

Post by andyscott12 » Wed 22 Aug 2012 13:28

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.

BGrojer
Posts: 18
Joined: Thu 19 Sep 2013 12:35

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

Post by BGrojer » Thu 19 Sep 2013 12:37

Is this issue solved or happend again to you AndyScott?

bpipe
Posts: 19
Joined: Mon 08 Oct 2012 12:14

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

Post by bpipe » Fri 03 Jul 2015 08:32

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)

Pinturiccio
Devart Team
Posts: 2420
Joined: Wed 02 Nov 2011 09:44

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

Post by Pinturiccio » Mon 06 Jul 2015 14:11

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.

bpipe
Posts: 19
Joined: Mon 08 Oct 2012 12:14

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

Post by bpipe » Mon 20 Jul 2015 12:21

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.

Pinturiccio
Devart Team
Posts: 2420
Joined: Wed 02 Nov 2011 09:44

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

Post by Pinturiccio » Wed 22 Jul 2015 10:31

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.

bpipe
Posts: 19
Joined: Mon 08 Oct 2012 12:14

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

Post by bpipe » Fri 07 Aug 2015 12:40

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);

Pinturiccio
Devart Team
Posts: 2420
Joined: Wed 02 Nov 2011 09:44

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

Post by Pinturiccio » Tue 11 Aug 2015 12:26

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.

Post Reply