Skip to content
This repository has been archived by the owner on Feb 16, 2020. It is now read-only.

SQLITE_BUSY: database is locked #1189

Closed
1 of 3 tasks
bokub opened this issue Oct 7, 2017 · 19 comments
Closed
1 of 3 tasks

SQLITE_BUSY: database is locked #1189

bokub opened this issue Oct 7, 2017 · 19 comments

Comments

@bokub
Copy link

bokub commented Oct 7, 2017

  • I'm submitting a ...
  • bug report
  • feature request
  • question about the decisions made in the repository
  • Action taken

Started from a clean repo (first time with gekko)
Ran npm install
Ran node gekko --ui
Added a new 'paper trader' gekko using the interface, with default options

  • Actual result

Immediate alert() popup saying 'GEKKO ERROR: Child process has died.'

  • Other information
Stacktrace here
TAlib is disabled
Serving Gekko UI on http://localhost:3000/

  <-- GET /api/imports
  --> GET /api/imports 200 5ms 2b
  <-- GET /api/gekkos
  --> GET /api/gekkos 200 1ms 2b
  <-- GET /api/apiKeys
  --> GET /api/apiKeys 200 1ms 2b
  <-- GET /api/exchanges
  --> GET /api/exchanges 200 1,008ms 58.82kb
  <-- GET /api/gekkos
  --> GET /api/gekkos 200 1ms 2b
  <-- GET /api/imports
  --> GET /api/imports 200 1ms 2b
  <-- GET /api/gekkos
  --> GET /api/gekkos 200 0ms 2b
  <-- GET /api/apiKeys
  --> GET /api/apiKeys 200 2ms 2b
  <-- GET /api/exchanges
  <-- GET /api/gekkos
  --> GET /api/gekkos 200 0ms 2b
  --> GET /api/exchanges 200 8ms 58.82kb
  <-- GET /api/imports
  --> GET /api/imports 200 1ms 2b
  <-- GET /api/gekkos
  --> GET /api/gekkos 200 1ms 2b
  <-- GET /api/apiKeys
  --> GET /api/apiKeys 200 1ms 2b
  <-- GET /api/exchanges
  <-- GET /api/gekkos
  --> GET /api/gekkos 200 1ms 2b
  --> GET /api/exchanges 200 7ms 58.82kb
  <-- GET /api/configPart/candleWriter
  <-- GET /api/configPart/performanceAnalyzer
  --> GET /api/configPart/candleWriter 200 8ms 47b
  --> GET /api/configPart/performanceAnalyzer 200 6ms 144b
  <-- GET /api/strategies
  --> GET /api/strategies 200 3ms 1.49kb
  <-- GET /api/configPart/paperTrader
  --> GET /api/configPart/paperTrader 200 1ms 132b
  <-- GET /api/configPart/candleWriter
  <-- GET /api/configPart/performanceAnalyzer
  --> GET /api/configPart/candleWriter 200 7ms 47b
  --> GET /api/configPart/performanceAnalyzer 200 8ms 144b
  <-- GET /api/strategies
  --> GET /api/strategies 200 3ms 1.49kb
  <-- GET /api/configPart/paperTrader
  --> GET /api/configPart/paperTrader 200 1ms 132b
  <-- POST /api/startGekko
Gekko 353267897781442 started
  --> POST /api/startGekko 200 22ms 146b
  <-- POST /api/startGekko
Gekko 034881364069969 started
  --> POST /api/startGekko 200 12ms 446b
  <-- POST /api/getCandles
  --> POST /api/getCandles 200 329ms 2b
events.js:182
      throw er; // Unhandled 'error' event
      ^

Error: SQLITE_BUSY: database is locked
RECEIVED ERROR IN GEKKO 034881364069969
Child process has died.

P.S
I saw the other related issues. In other threads, the problems occurs after a few hours, mine occurs immediately.
I do not have multiple instances of gekko running.

@generalectric
Copy link
Contributor

What operating system are you running?

@bokub
Copy link
Author

bokub commented Oct 7, 2017

Sorry I forgot that detail
Linux Mint 18

@generalectric
Copy link
Contributor

Have you tried changing the journal mode from WAL to DEL in plugins/sqlite/handle.js? Possibly totally unrelated but I have had issues in the past with sqlite and database locking and for me my problem was solved by changing the journal mode.

@bokub
Copy link
Author

bokub commented Oct 8, 2017

Thanks for your quick answer, but that did not fix the problem. The behavior and stacktrace are exactly the same

@bokub
Copy link
Author

bokub commented Oct 8, 2017

I see that there is a mongodb pulgin. Can I use it instead of sqlite ? How ?

I cannot find anything related in the documentation

@grunt-logic
Copy link

Running sudo node gekko --ui on startup fixed this for me. User permissions issue maybe?

@bokub
Copy link
Author

bokub commented Oct 9, 2017

Nope, still an error.

However, I have noticed something really interesting:
The problem occurs when I add a gekko on a Bitstamp market, but not on a Poloniex or a Bittrex market.

xerix32 added a commit to xerix32/gekko that referenced this issue Oct 21, 2017
@xerix32
Copy link
Contributor

xerix32 commented Oct 21, 2017

This works for me, try to add

+db.configure('busyTimeout', 1500);
in plugins/sqlite/handle.js

This raises busyTimeout.

My Pull Reuest

@darkcloud8
Copy link

darkcloud8 commented Oct 24, 2017

i had this same issue for paper trader on version 0.5.8 for BTC Markets. i just recompiled the version 0.5.9 and the same issue is still occurring. i have tried Poloniex and its not happening on that market. it has not been fixed for BTC Markets

Error messsage in the console:
Gekko 1468339149843594 started
--> POST /api/startGekko 200 216ms 151b
<-- POST /api/startGekko
Gekko 2426912742571705 started
--> POST /api/startGekko 200 199ms 450b
<-- POST /api/getCandles
events.js:160
throw er; // Unhandled 'error' event
^

Error: SQLITE_BUSY: database is locked
at Error (native)
RECEIVED ERROR IN GEKKO 2426912742571705
Child process has died.

@askmike
Copy link
Owner

askmike commented Oct 24, 2017

@darkcloud8 can you be more specific in what you are doing: When this happens how many gekkos are running (UI + commandline)? How many of those use BTC-markets?

@darkcloud8
Copy link

darkcloud8 commented Oct 24, 2017

Only 1 gekko running in UI mode.
I start Paper Trader for BTC-markets and set it to AUD to BTC. Left everything else on default and click start.
Within 5secs of starting it i get the error the Child process has died on the UI and i check the console it gives me that error message in the previous comment.

@askmike
Copy link
Owner

askmike commented Oct 24, 2017 via email

@darkcloud8
Copy link

I have only tested Poloniex but i will test the rest now and get back to you.

@xerix32
Copy link
Contributor

xerix32 commented Oct 24, 2017

Can be related to the number of transaction ? BTC has generally more volume/transactions to write on DB.

I think is related on hardware too, I see the problem only on raspberry (on my notebook works good), but with 1500 timeout I've no problems.

What hardware have you?

@darkcloud8
Copy link

I'm running it on my QNAP TS-453A in the Container Station.

My setup on the QNAP is running 3 docker containers
1: CommandLine Only running a Watcher on BTC-Markets AUD-BTC
2: CommandLine Only running a Watcher on BTC-Markets AUD-ETH
3: UI trying to run the BTC-Markets Paper Trader for AUD-BTC

All 3 containers have separate history folders

@darkcloud8
Copy link

darkcloud8 commented Oct 24, 2017

@askmike i have tested all the markets, the ones below throw me errors on Paper Trader with default options. It seems like the error i'm getting on BTC-Markets is happening on kraken too. All the others looks like different errors. Hope that is useful information.

bx.in.th
Gekko 633825640172174 started
--> POST /api/startGekko 200 291ms 147b

/usr/src/app/core/budfox/tradeBatcher.js:40
throw 'tid is not a string';
^
tid is not a string
RECEIVED ERROR IN GEKKO 633825640172174
Child process has died.

cexio
Gekko 633825640172174 started
--> POST /api/startGekko 200 291ms 147b

/usr/src/app/core/budfox/tradeBatcher.js:40
throw 'tid is not a string';
^
tid is not a string
RECEIVED ERROR IN GEKKO 633825640172174
Child process has died.

kraken
Gekko 491472340492585 started
--> POST /api/startGekko 200 106ms 145b
<-- POST /api/startGekko
Gekko 21218850992437 started
--> POST /api/startGekko 200 202ms 443b
<-- POST /api/getCandles
events.js:160
throw er; // Unhandled 'error' event
^

Error: SQLITE_BUSY: database is locked
at Error (native)
RECEIVED ERROR IN GEKKO 21218850992437
Child process has died.

lakebtc
Doesn't show an error but it doesn't even start (seems like i can't connect to the server)

@askmike
Copy link
Owner

askmike commented Oct 24, 2017

Ah you picked some very old exchanges haha. Anyway:

Error: SQLITE_BUSY: database is locked

This is most likely related to your NAS. Especially if you are not running any other Gekko at the same time. Would you be able to test Gekko on anything else (laptop, computer, server) to see if Kraken, Poloniex, Bitstamp or GDAX works?

@darkcloud8
Copy link

darkcloud8 commented Oct 24, 2017

i tried it on my laptop, Kraken, Poloniex, Bitstamp and GDAX all works fine but with BTC-Markets i still get a Child process has died error on the UI. The Watcher still looks like its running, i can confirm about the Paper Trader part has stopped updating.

@darkcloud8
Copy link

i tried Kraken on a few different Currency to Asset setup and everything else on default on Paper Trader. I have notice that Kraken and BTC-Market both imports massive amount of data depend on what time of the day it is. Anything over 4-5hours of data the Paper Trader will crash and throw the Child process has died error.
I'm testing this on my laptop and not my NAS. If you go try Kraken with JPY to ETH setting, it is throwing the error 100% of the time because the data is at 1 Day 3 Hours + right now.

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

No branches or pull requests

6 participants