-
Notifications
You must be signed in to change notification settings - Fork 102
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
table lock - concurrency problem #120
Comments
I'd use context.Context (for timeouts) and |
What do you want to test? In a Go program, you won't create more sql.DB pools per database, only one. Maybe I've found a fix for the empty errors - see 7c96931 For your tests, I'd use context for timeouts: |
Hey @tgulacsi , I should give you more information. I am writing a backend application in go I don't know how ofter the application will be started in the cluster, but to This is also the reason for 25 instances of the sql.DB pools. Each sql.DB pool I applied your patch into my example project. I saw you implemented a mutex. I Next to the context. I try to change the code to use a context. I can pass the Now again to your patch. The test is successfully on my local system. On our locker_test.go:103:
Error Trace: locker_test.go:103
Error: Should be true
Test: TestLocker/Concurrency
Messages: Failed to create table schema_lock: dpiStmt_execute(mode=0 arrLen=-1):
--- FAIL: TestLocker (0.79s)
--- PASS: TestLocker/lock-unlock (0.57s)
--- FAIL: TestLocker/Concurrency (0.22s) |
"Maybe I've found a fix for the empty errors - see 7c96931" |
@voler-raschk, I am not recommending the below change, for my
understanding, can you add this and let me know your CI results.
go func(index int, sqlDBO *sql.DB) {
+ runtime.LockOSThread()
…On Sat, Dec 19, 2020 at 3:30 PM Tamás Gulácsi ***@***.***> wrote:
"Maybe I've found a fix for the empty errors - see 7c96931
<7c96931>
"
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#120 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ALRPMOSGB5CGNPJFWOWYDVDSVR2UZANCNFSM4VBMRHQA>
.
|
@sudarshan12s , thanks a lot for the hint with Since there is a dependency on a C library by godror it seems that it must be ensured that the C code runs in the same thread as the Go routines. Some additional links: Now I am wondering how far this could have implications on existing code where I think this is only necessary when an application opens multiple DB pools or did I misunderstand something? |
I still does not understand what's happening. @volker-raschek , can you post us a failing CI log of yout test using v0.22.3, but WITHOUT runtime.LockOSThread() ? That should not have empty error message. |
Encapsulate execution of OCI function and getting error in runtime.LockOSThread and runtime.UnlockOSThread. For #120.
@volker-raschek can you try 8411931 without runtime.LockOSThread ? |
Yes i was indicating TLS used for storing error context in C libs in this case. Other thing I wanted to clarify is on application instance. By application instance, you mean a seperate process , right? which creates a pool. |
Hello folks,
I have written an oracle driver for https://github.com/golang-migrate/migrate using godror as the driver. To prevent multiple instances from migrating an oracle database the schema_lock table is locked and a row is inserted. Other instances should then not start the migration.
Locally on my system and inside a container, the tests run successfully. In our internal CI the test fails with the same container image.
Information:
Under the project https://github.com/volker-raschek/locker I have implemented everything to reproduce the error. Again, local on my system the test is successfully, but in our internal CI the test fails.
Unfortunately I can't catch the error with an ORA error code, because it doesn't contain one. Sometimes I get an error message like this one
dpiStmt_execute(mode=0 arrLen=-1):
or nothing. I am not sure if there is something wrong with my source code or the SQL statements or godror has a bug.Please have a look at my sample code and the logs and reproduce the error if necessary.
Volker
To Reproduce
Expected behavior
The intergration tests are successfully on both systems (local and ci)
logs are attached as seperate files
ci.log
local-system.log
The text was updated successfully, but these errors were encountered: