Race Condition For First Run
See original GitHub issueWhen spawning multiple studies with the same postgres backend, the script crashes because each process tries to create the db table.
Expected behavior
db lock, no crash.
Environment
- Optuna version: 1.2.0
- Python version: 3.8
Error messages, stack traces, or logs
..
sqlalchemy.exc.ProgrammingError: ... relation "alembic_version" already exists
..
sqlalchemy.exc.IntegrityError: ... duplicate key value violates unique constraint "pg_type_typename_nsp_index"
..
Steps to reproduce
[delete optuna db tables]
python exp.py exp1 &
python exp.py exp2 &
python exp.py exp3 &
Additional context (optional)
only tried postgres
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
What is a Race Condition? - TechTarget
A race condition is an undesirable situation that occurs when a device or system attempts to perform two or more operations at the...
Read more >Race conditions and deadlocks - Visual Basic - Microsoft Learn
A race condition occurs when two threads access a shared variable at the same time. The first thread reads the variable, and the...
Read more >What is a race condition? - Stack Overflow
A race condition occurs when two or more threads can access shared data and they try to change it at the same time....
Read more >What is a Race Condition? | Baeldung on Computer Science
By definition, a race condition is a condition of a program where its behavior depends on relative timing or interleaving of multiple threads...
Read more >Race condition - Wikipedia
A race condition can arise in software when a computer program has multiple code paths that are executing at the same time. If...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks, it solved my problem.
@c-bata I’m encountering a similar seeming problem, however I don’t quite follow the solution you proposed and as best I can tell the documentation for it hasn’t been updated either. If you could please explain it in a little more detail I’d be happy to create a PR adding this to the documentation