testdouble / testdouble/suture
Errors while writing to sqlite DB
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 1.4k
- Forks
- 27
- Avg merge
- 27m
- Merged PRs (30d)
- 2
Description
Not sure if this is a bug, but it could be depending on suture's philosophy. Should production legacy code break while I'm recording calls?
I had a separate sqlite client open to verify suture was recording (while the app was running), which doesn't seem unreasonable if I install this for a few days and want to see if it has captured "enough" information yet.
Code
def current_category
Suture.create(:current_category, {
old: method(:old_current_category),
args: [ @places[@current_player] ]
})
end
def old_current_category(place)
return 'Pop' if place == 0
return 'Pop' if place == 4
return 'Pop' if place == 8
return 'Science' if place == 1
return 'Science' if place == 5
return 'Science' if place == 9
return 'Sports' if place == 2
return 'Sports' if place == 6
return 'Sports' if place == 10
return 'Rock'
end
stack trace
/Users/stevejackson/.rvm/gems/ruby-1.9.3-p551@trivia/gems/sqlite3-1.3.11/lib/sqlite3/statement.rb:108:in `step': database is locked (SQLite3::BusyException)
from /Users/stevejackson/.rvm/gems/ruby-1.9.3-p551@trivia/gems/sqlite3-1.3.11/lib/sqlite3/statement.rb:108:in `block in each'
from /Users/stevejackson/.rvm/gems/ruby-1.9.3-p551@trivia/gems/sqlite3-1.3.11/lib/sqlite3/statement.rb:107:in `loop'
from /Users/stevejackson/.rvm/gems/ruby-1.9.3-p551@trivia/gems/sqlite3-1.3.11/lib/sqlite3/statement.rb:107:in `each'
from /Users/stevejackson/.rvm/gems/ruby-1.9.3-p551@trivia/gems/sqlite3-1.3.11/lib/sqlite3/database.rb:158:in `to_a'
from /Users/stevejackson/.rvm/gems/ruby-1.9.3-p551@trivia/gems/sqlite3-1.3.11/lib/sqlite3/database.rb:158:in `block in execute'
from /Users/stevejackson/.rvm/gems/ruby-1.9.3-p551@trivia/gems/sqlite3-1.3.11/lib/sqlite3/database.rb:95:in `prepare'
from /Users/stevejackson/.rvm/gems/ruby-1.9.3-p551@trivia/gems/sqlite3-1.3.11/lib/sqlite3/database.rb:134:in `execute'
from /Users/stevejackson/.rvm/gems/ruby-1.9.3-p551@trivia/gems/suture-1.1.1/lib/suture/wrap/sqlite.rb:17:in `block in init'
from /Users/stevejackson/.rvm/gems/ruby-1.9.3-p551@trivia/gems/suture-1.1.1/lib/suture/wrap/sqlite.rb:11:in `tap'
from /Users/stevejackson/.rvm/gems/ruby-1.9.3-p551@trivia/gems/suture-1.1.1/lib/suture/wrap/sqlite.rb:11:in `init'
from /Users/stevejackson/.rvm/gems/ruby-1.9.3-p551@trivia/gems/suture-1.1.1/lib/suture/adapter/dictaphone.rb:13:in `initialize'
from /Users/stevejackson/.rvm/gems/ruby-1.9.3-p551@trivia/gems/suture-1.1.1/lib/suture/surgeon/observer.rb:7:in `new'
from /Users/stevejackson/.rvm/gems/ruby-1.9.3-p551@trivia/gems/suture-1.1.1/lib/suture/surgeon/observer.rb:7:in `operate'
from /Users/stevejackson/.rvm/gems/ruby-1.9.3-p551@trivia/gems/suture-1.1.1/lib/suture/create/performs_surgery.rb:4:in `perform'
from /Users/stevejackson/.rvm/gems/ruby-1.9.3-p551@trivia/gems/suture-1.1.1/lib/suture/create.rb:10:in `create'
from /Users/stevejackson/projects/trivia/ruby/lib/ugly_trivia/game.rb:91:in `current_category'
from /Users/stevejackson/projects/trivia/ruby/lib/ugly_trivia/game.rb:76:in `roll'
from bin/trivia:18:in `<main>'
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with lib/suture/wrap/sqlite.rb, especially the initialization path shown in the stack trace, and reproduce the failure with a separate SQLite client reading while Suture records calls from lib/ugly_trivia/game.rb. Compare the observed behavior with Suture's intended failure policy and document or test the expected result for concurrent database access.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby, sqlite
- Domain
- database
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100