SCM

[#1010826] Thread safety fix for PGUtil

View Trackers | Patches | Download .csv | Monitor

Date:
2010-05-20 16:21
Priority:
3
State:
Open
Submitted by:
Matthew Gabeler-Lee (cheetah)
Assigned to:
Nobody (None)
Category:
Group:
Resolution:
None
 
Summary:
Thread safety fix for PGUtil

Detailed description
(see http://pgfoundry.org/forum/message.php?msg_id=1006084 )

PGUtil has a thread safety problem introduced in CVS revision 1.13 (Knuth: "Premature optimization is the root of all evil"). The optimization introduced in that revision effectively means that Npgsql can only be used by one thread at a time, even with separate connections.

Attached is a patch that makes the buffers thread local to keep most of the optimization and remove the thread safety issue.

Followup

Message
Date: 2010-05-23 18:16
Sender: Francisco Figueiredo jr.


Hi, Matthew.

I ended up reverting my patch because the gain was near nothing and the problem was huge as you've shown.

Thanks for your patch, but also the idea of having an "if" inside the code would give an extra performance hit.

I think letting the buffer as local variable is ok for now. Maybe we can think about a better idea without concurrency problems.

Thank you very much for your testing and getting this problem.

Attached Files:

Attachments:
PGUtil.patch

Changes:

Field Old Value Date By
File Added484: PGUtil.patch2010-05-20 16:21cheetah
Powered By FusionForge