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

Cross platform database openness check #64

Open
ceyhunsen opened this issue Sep 6, 2024 · 1 comment
Open

Cross platform database openness check #64

ceyhunsen opened this issue Sep 6, 2024 · 1 comment
Labels
bug Something isn't working enhancement New feature or request help wanted Extra attention is needed question Further information is requested

Comments

@ceyhunsen
Copy link
Member

Currently, Client::new() checks if ledger is open to another client with lsof command. If not starts a clean ledger and if it is just connects. This works fine but not cross platform. Probably not work on windows.

#63 was an attempt to this problem. But it had it's problem.

There is another option: Start a server and write it's port to database. Then new clients first tries to connect to that server. If server is not responding, start a new ledger and a server. This approach also has caveats: Simple ping checks takes lots of time. This is not acceptable for multiple tests.

Changing database is another option. Redis provides in-memory database with connection information. Could be a good replacement to SQLite3.

@ceyhunsen ceyhunsen added bug Something isn't working enhancement New feature or request help wanted Extra attention is needed question Further information is requested labels Sep 6, 2024
@ceyhunsen
Copy link
Member Author

Another possible bug: Clear database when other RPC clients are dropped but test as a whole is not finished. Meaning current check for openness is also problematic. Possible scenario on a test:

  1. Clients starts and does their job
  2. Clients get dropped after
  3. New client connects to ledger
  4. Sees that no other process is connected to database
  5. Clears database and inevitably clears that test's previous work

This scenario can happen even with lsof and needs to be addressed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant