我在sqlite3 ruby扩展中发现了一个死锁,并在这里修复它:试一试,看看它是否能解决你的问题。
https://github.com/dxj19831029/sqlite3-ruby
我打开了一个拉请求,没有他们的回应。
无论如何,预计一些繁忙的异常,如sqlite3本身所述。
注意这个条件:sqlite busy
The presence of a busy handler does not guarantee that it will be invoked when there is
lock contention. If SQLite determines that invoking the busy handler could result in a
deadlock, it will go ahead and return SQLITE_BUSY or SQLITE_IOERR_BLOCKED instead of
invoking the busy handler. Consider a scenario where one process is holding a read lock
that it is trying to promote to a reserved lock and a second process is holding a reserved
lock that it is trying to promote to an exclusive lock. The first process cannot proceed
because it is blocked by the second and the second process cannot proceed because it is
blocked by the first. If both processes invoke the busy handlers, neither will make any
progress. Therefore, SQLite returns SQLITE_BUSY for the first process, hoping that this
will induce the first process to release its read lock and allow the second process to
proceed.
如果符合这个条件,超时不再有效。为了避免它,不要把选择放在开始/提交。或者使用独占锁来开始/提交。
希望这会有所帮助。 :)
什么源码的版本? – 2008-09-17 01:12:03
我敢打赌,您的生产环境主机使用NFS作为应用用户的家目录,不是吗? – ybakos 2010-11-19 15:41:35