Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System.NullReferenceException at FirebirdSql.Data.FirebirdClient.FbConnectionPool.get_Count() [DNET366] #371

Closed
firebird-automations opened this issue Feb 15, 2011 · 2 comments

Comments

@firebird-automations
Copy link

Submitted by: Fernando Nájera (fernandonajera)

I just got the following exception while my application was running:

System.NullReferenceException: Object reference not set to an instance of an object.
at FirebirdSql.Data.FirebirdClient.FbConnectionPool.get_Count() in C:\Users\Jiri\Desktop\NETProvider\source\FirebirdSql\Data\FirebirdClient\FbConnectionPool.cs:line 82
at FirebirdSql.Data.FirebirdClient.FbConnectionPool.CleanupWorker(Object state) in C:\Users\Jiri\Desktop\NETProvider\source\FirebirdSql\Data\FirebirdClient\FbConnectionPool.cs:line 303
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)
at System.Threading._TimerCallback.PerformTimerCallback(Object state)

Unfortunately I cannot replicate it -- which is probably because this might be a timing issue (I can see threads in the stacktrace... so probably I hit a race condition).

Having a look at the source code of FbConnectionPool, I guess the problem might be that one thread is disposing the object while another one is asking for .Count. I can see that .Count is calling "lock (this.unlocked.SyncRoot)", but during the disposal that variable might be already null...

Commits: 7d3c894

@firebird-automations
Copy link
Author

Modified by: @cincuranet

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 2.6.1 [ 10400 ]

@firebird-automations
Copy link
Author

Commented by: @cincuranet

I think I've fixed it. Although I'm not happy with the way how connection pool works now, I don't have enough time to reimplement it. :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants