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

[wasm/bug] Handle error when trying to open already opened database #1158

Closed
SirSevenG opened this issue Dec 2, 2021 · 9 comments · Fixed by #1162
Closed

[wasm/bug] Handle error when trying to open already opened database #1158

SirSevenG opened this issue Dec 2, 2021 · 9 comments · Fixed by #1162
Assignees
Labels
bug Something isn't working
Projects

Comments

@SirSevenG
Copy link

Case: in mobile/desktop/web application user can have multiple wallets with the exact same seed be it intentionally or by mistake.

While libmm2 handles it well. wasm module has issues with it. Trying to switch between different wallets with same seed phrase in web app leads to error Internal error: Database 'MAIN::hash::swap' is open already.

To reproduce you may use build from PR 154 (air_dex) and later dev, when merged. I will notify in comments.

Steps to reproduce:

  • create two or more wallets with the same seed (import wallet from the main screen)
  • login in one of 'em
  • from top right corner of the screen press wallet name -> select from drop down menu other wallet
  • enter password, confirm log in
  • see error in browser console
@artemii235 artemii235 added the bug Something isn't working label Dec 2, 2021
@artemii235 artemii235 added this to Todo in MM 2.0 via automation Dec 2, 2021
@artemii235 artemii235 moved this from Todo to In progress in MM 2.0 Dec 2, 2021
@artemii235
Copy link
Member

@sergeyboyko0791 Could you please take a look and fix this?

@sergeyboyko0791
Copy link

I think it's related to this #1020 issue.
As for now, we can't guarantee that a MarketMaker instance is stopped immediately on stop RPC call. The last time I tested it, it took ~30s to stop every spawned future. So while the old instance is run, databases are open too.

The problem can be also related to hanging pointers: #985
In the PR mentioned above, I fixed the error, but it could appear again since we continue extending and developing atomicDEX-API.

@SirSevenG could you please check if you can log in after 30s-60s timeout?

@SirSevenG
Copy link
Author

SirSevenG commented Dec 2, 2021

Tried the following:

2 wallets with different seeds. A and B.

Case 1:

  • Log in into A.
  • Switch to B - no issues.
  • Switch back to A (less than 30s passed)
  • database is still open.

Case 2:

  • Log in into A.
  • Switch to B - no issues.
  • Switch back to A (more than 120s passed)
  • database is still open.

So 2+ minutes is not enough to prevent database is open already error.

So you have to log out completely (and/or reload web page) to clear databses connections.

@artemii235
Copy link
Member

cc @sergeyboyko0791 ☝️

@sergeyboyko0791
Copy link

I'll investigate this issue today, thanks for the testing @SirSevenG

@sergeyboyko0791 sergeyboyko0791 linked a pull request Dec 7, 2021 that will close this issue
@sergeyboyko0791 sergeyboyko0791 moved this from In progress to Testing in MM 2.0 Dec 9, 2021
@SirSevenG
Copy link
Author

SirSevenG commented Dec 9, 2021

Small update: #1162 fixes only one of the issues listed above. Database error still persists in general.

artemii235 pushed a commit that referenced this issue Dec 9, 2021
* Fix hanging pointers
* Add 'SharedRc' and 'WeakRc' that can be used to debug hanging pointers
* Move 'MmCtx::stop' to 'MmArc::stop'
* Replace 'Arc<MmCtx>' with 'SharedRc<MmCtx>'

* Fix tests compilation
@artemii235
Copy link
Member

@SirSevenG @sergeyboyko0791 What is the current status of this issue?

@sergeyboyko0791
Copy link

Should be fixed by #1490
@yurii-khi Have you had a chance to test how long mm2 stops after the PR mentioned above?

@onur-ozkan
Copy link
Member

Will close this due to #1158 (comment)

Feel free to re-open if the problem still exists.

MM 2.0 automation moved this from Testing to Done May 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
MM 2.0
  
Done
Development

Successfully merging a pull request may close this issue.

4 participants