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

panic on unlock of unlocked mutex #81

Closed
bundgaard opened this issue Aug 3, 2023 · 5 comments · Fixed by #84
Closed

panic on unlock of unlocked mutex #81

bundgaard opened this issue Aug 3, 2023 · 5 comments · Fixed by #84

Comments

@bundgaard
Copy link

Hi @proullon

Receiving panic from using sql.Db#Begin, sql.Db.Commit(), sql.Db.Rollback

2023/08/02 23:01:39 incoming messages 32345, elapsed seconds since start   41, routes 0
fatal error: sync: unlock of unlocked mutex

goroutine 596 [running]:
sync.fatal({0x7ff616d2d069?, 0x20?})
        C:/Users/Users/sdk/go1.20.3/src/runtime/panic.go:1031 +0x1e
sync.(*Mutex).unlockSlow(0xc00010e000, 0xffffffff)
        C:/Users/Users/sdk/go1.20.3/src/sync/mutex.go:229 +0x3c
sync.(*Mutex).Unlock(0x1?)
        C:/Users/Users/sdk/go1.20.3/src/sync/mutex.go:223 +0x29
github.com/proullon/ramsql/driver.(*Stmt).Exec(0xc0008fa240, {0xc00078b7a0?, 0xc0008fa240?, 0x0?})
        C:/Users/Users/go/pkg/mod/github.com/proullon/[email protected]/driver/stmt.go:108 +0x32e
database/sql.ctxDriverStmtExec({0x7ff616dbade8, 0xc00001c040}, {0x7ff616dbafa8, 0xc0008fa240}, {0xc000928480?, 0x3, 0x3})
        C:/Users/Users/sdk/go1.20.3/src/database/sql/ctxutil.go:77 +0x1f9
database/sql.resultFromStatement({0x7ff616dbade8, 0xc00001c040}, {0x7ff616dba840, 0xc00010e000}, 0xc0000a2440, {0xc0013bd738, 0x3, 0x3})
        C:/Users/Users/sdk/go1.20.3/src/database/sql/sql.go:2635 +0x145
database/sql.(*Stmt).ExecContext.func1(0x8?)
        C:/Users/Users/sdk/go1.20.3/src/database/sql/sql.go:2609 +0xa7
database/sql.(*DB).retry(0x20?, 0xc0013bd548)
        C:/Users/Users/sdk/go1.20.3/src/database/sql/sql.go:1538 +0x47
database/sql.(*Stmt).ExecContext(0xc001552064?, {0x7ff616dbade8?, 0xc00001c040?}, {0xc0013bd738?, 0x0?, 0x0?})
        C:/Users/Users/sdk/go1.20.3/src/database/sql/sql.go:2603 +0x17c
database/sql.(*Stmt).Exec(...)
        C:/Users/Users/sdk/go1.20.3/src/database/sql/sql.go:2623
main.insertRoute(0xc000554050?, 0xc0006064b0)
        C:/Code/backend_backend/simple/repository.go:67 +0x665
main.(*ramsqlRepository).Insert(0xc00010e2e0, 0xc0000bf0e0?)
        C:/Code/backend_backend/simple/ramsql.go:36 +0x7e
main.shipReachedDestination.func1({0x7ff616d0fda0?, 0x35520e6829?}, 0xc0008e4200)
        C:/Code/backend_backend/simple/main.go:316 +0x388
net/http.HandlerFunc.ServeHTTP(0xc00007c800?, {0x7ff616dbaba0?, 0xc000918540?}, 0xc0013bd938?)
        C:/Users/Users/sdk/go1.20.3/src/net/http/server.go:2122 +0x2f
net/http.(*ServeMux).ServeHTTP(0xc0013bd950?, {0x7ff616dbaba0, 0xc000918540}, 0xc0008e4200)
        C:/Users/Users/sdk/go1.20.3/src/net/http/server.go:2500 +0x149
net/http.StripPrefix.func1({0x7ff616dbaba0, 0xc000918540}, 0xc0008e4100)
        C:/Users/Users/sdk/go1.20.3/src/net/http/server.go:2165 +0x332
net/http.HandlerFunc.ServeHTTP(0x7ff6167f7460?, {0x7ff616dbaba0?, 0xc000918540?}, 0x7ff6167f6ddd?)
        C:/Users/Users/sdk/go1.20.3/src/net/http/server.go:2122 +0x2f
net/http.(*ServeMux).ServeHTTP(0x3b?, {0x7ff616dbaba0, 0xc000918540}, 0xc0008e4100)
        C:/Users/Users/sdk/go1.20.3/src/net/http/server.go:2500 +0x149
main.countIncomingRequests.func1({0x7ff616dbaba0, 0xc000918540}, 0xc0013bdad0?)
        C:/Code/backend_backend/simple/main.go:116 +0x68
net/http.HandlerFunc.ServeHTTP(0x0?, {0x7ff616dbaba0?, 0xc000918540?}, 0x7ff616abef34?)
        C:/Users/Users/sdk/go1.20.3/src/net/http/server.go:2122 +0x2f

@proullon
Copy link
Owner

proullon commented Aug 3, 2023

Hi,

I recently merged in master a complete rewrite. Can you go get ramsql@master and check if you run into the same issue ?

@bundgaard
Copy link
Author

bundgaard commented Aug 3, 2023

After updating to your latest master, my application just hangs, it does not spew out any log messages or anything. I cannot see how I can provide you with more information, except updating to github.com/proullon/ramsql v0.0.2-0.20230729003203-601411239223 makes the application just hang or not show any stdout.
I do not see any new commits on master.

@proullon
Copy link
Owner

proullon commented Aug 3, 2023

Alright, I'll check tests coverage, thanks

@proullon
Copy link
Owner

Hi,

There was indeed an issue with transactions on master, now fixed.

@bundgaard
Copy link
Author

Awesome, thank you for the work on both of my issues.

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

Successfully merging a pull request may close this issue.

2 participants