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

Use database temp dir for wallet db in integration tests instead of in-memory DB #1240

Closed
wants to merge 2 commits into from

Conversation

piotr-iohk
Copy link
Contributor

Issue Number

Overview

  • I have modified integration tests so they are using temp dir during test execution

Comments

Unfortunately tests failed for me locally with:

[cardano-wallet.worker:Error:4762] [2019-12-31 12:34:49.81 UTC] 7f084053: Recoverable error following the chain: SQLite3 returned ErrorMisuse while attempting to perform bind text.
Statement[cardano-wallet.worker:Info:4762] [2019-12-31 12:34:50.36 UTC] 7f084053: Applying blocks [1079666.5 ... 1079677.5]
AlreadyFinalized "BEGIN"
[cardano-wallet.worker:Error:4762] [2019-12-31 12:34:50.36 UTC] 7f084053: Recoverable error following the chain: StatementAlreadyFinalized "BEGIN"
[cardano-wallet.stake-pools:Info:2025] [2019-12-31 12:34:51.17 UTC] Applying blocks [1079681.7 ... 1079681.7]
malloc(): memory corruption

During the test I was also observing a lot of errors after deleting the wallet:

[cardano-wallet.worker:Error:4683] [2019-12-31 12:34:49.33 UTC] c0486500: Worker has exited unexpectedly: SQLite3 returned ErrorMisuse while attempting to perform close: bad parameter or other API misuse

@piotr-iohk piotr-iohk added this to the Clean up integration tests milestone Dec 31, 2019
@piotr-iohk piotr-iohk self-assigned this Dec 31, 2019
@rvl
Copy link
Contributor

rvl commented Jan 2, 2020

These errors are interesting and look like some kind of concurrency issue. Are any tests running concurrently? This could be disabled with stack test --ta '--jobs 1' ...

  • SQLite supports multiple processes accessing the same database file concurrently.
  • SQLite also supports multiple threads within the same process accessing the same database file. This is because persistent-sqlite compiles with SQLITE_THREADSAFE=1 and therefore serializes the db statements.

Perhaps the .wal file gets deleted while SQLite expects it to exist?

@piotr-iohk piotr-iohk force-pushed the piotr/temp_dir_for_db_in_integration_tests branch from 24148ab to 7e7c911 Compare January 2, 2020 11:17
@piotr-iohk
Copy link
Contributor Author

Are any tests running concurrently?

There were some tests running in parallel. I have the parallel (temporarily to check the behavior) in 7e7c911.

After this the tests were running fine, until one of them failed and then all subsequent seemed to fail too:

 src/Test/Integration/Framework/DSL.hs:369:5: 
  1) API Specifications, STAKE_POOLS_JOIN_01x - Fee boundary values, STAKE_POOLS_JOIN_01x - I cannot join stake-pool with 0 balance

       expected: Status {statusCode = 204, statusMessage = "No Content"}
        but got: Status {statusCode = 500, statusMessage = "Internal Server Error"}

  To rerun use: --match "/API Specifications/STAKE_POOLS_JOIN_01x - Fee boundary values/STAKE_POOLS_JOIN_01x - I cannot join stake-pool with 0 balance/"

  src/Test/Integration/Framework/DSL.hs:1308:20: 
  2) API Specifications, STAKE_POOLS_QUIT_01x - Fee boundary values, STAKE_POOLS_QUIT_01x - I can quit if I have enough to cover fee
       uncaught exception: ErrorCall
       deleteAllWallets: Cannot return wallets: DecodeFailure "Something went wrong"
       CallStack (from HasCallStack):
         error, called at src/Test/Integration/Framework/DSL.hs:1308:20 in cardano-wallet-core-integration-2019.6.24-4tlWRZOKIL21Vt85fyPn5j:Test.Integration.Framework.DSL

Note. Running STAKE_POOLS_JOIN_01x alone works fine, so I don't think it is a matter of this particular test...

Running with stack test --ta '--jobs 1'... caused tests to stop again with the same error as initially:

[cardano-wallet.worker:Error:4762] [2019-12-31 12:34:49.81 UTC] 7f084053: Recoverable error following the chain: SQLite3 returned ErrorMisuse while attempting to perform bind text.
Statement[cardano-wallet.worker:Info:4762] [2019-12-31 12:34:50.36 UTC] 7f084053: Applying blocks [1079666.5 ... 1079677.5]
AlreadyFinalized "BEGIN"
[cardano-wallet.worker:Error:4762] [2019-12-31 12:34:50.36 UTC] 7f084053: Recoverable error following the chain: StatementAlreadyFinalized "BEGIN"
[cardano-wallet.stake-pools:Info:2025] [2019-12-31 12:34:51.17 UTC] Applying blocks [1079681.7 ... 1079681.7]
malloc(): memory corruption

I have also reported #1242 to address the issue with error in log after deleting a wallet.

@piotr-iohk
Copy link
Contributor Author

Closing until #703 is done.

@piotr-iohk piotr-iohk closed this Jan 8, 2020
@KtorZ KtorZ deleted the piotr/temp_dir_for_db_in_integration_tests branch January 22, 2020 09:09
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 this pull request may close these issues.

2 participants