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

Multiprocess access #138

Closed
chuckb opened this issue Jun 8, 2022 · 4 comments
Closed

Multiprocess access #138

chuckb opened this issue Jun 8, 2022 · 4 comments

Comments

@chuckb
Copy link

chuckb commented Jun 8, 2022

I have one process that needs to read data only and one process that will be r/w to the same database. This is on a local Linux file system. I seem to be having some process instability doing this. Are there C flags that I should pass to my applications to insure this runs stably? Under what conditions may the reader encounter lock conditions?

@chuckb
Copy link
Author

chuckb commented Jun 8, 2022

More specifically, if my read/write process is by itself, it works fine. Once I start up the read only process (it opens the db with the UNQLITE_OPEN_READONLY flag), after a short while, on a commit, I will get an error -14 (UNQLITE_BUSY). If I then retry the commit, I get a segfault.

@chuckb
Copy link
Author

chuckb commented Jun 8, 2022

I was able to get a backtrace of the faulting r/w process. This fault occurs after a commit returns a -14, and then this fault occurs on the retried commit.

* thread #1, name = 'epoch-block-mat', stop reason = signal SIGSEGV: invalid address (fault address: 0x0)
    frame #0: 0x00005555555c1fe5 epoch-block-matcher`unqliteOsWrite(id=0x0000000000000000, pBuf=0x00007fffffffdb94, amt=4, offset=8) at unqlite.c:52480
   52477	}
   52478	UNQLITE_PRIVATE int unqliteOsWrite(unqlite_file *id, const void *pBuf, unqlite_int64 amt, unqlite_int64 offset)
   52479	{
-> 52480	  return id->pMethods->xWrite(id, pBuf, amt, offset);
   52481	}
   52482	UNQLITE_PRIVATE int unqliteOsTruncate(unqlite_file *id, unqlite_int64 size)
   52483	{
(lldb) bt
* thread #1, name = 'epoch-block-mat', stop reason = signal SIGSEGV: invalid address (fault address: 0x0)
  * frame #0: 0x00005555555c1fe5 epoch-block-matcher`unqliteOsWrite(id=0x0000000000000000, pBuf=0x00007fffffffdb94, amt=4, offset=8) at unqlite.c:52480
    frame #1: 0x00005555555c4198 epoch-block-matcher`WriteInt32(pFd=0x0000000000000000, iNum=4, iOfft=8) at unqlite.c:55574
    frame #2: 0x00005555555c6ce1 epoch-block-matcher`unqliteFinalizeJournal(pPager=0x0000555555a3e664, pRetry=0x00007fffffffdc00, close_jrnl=1) at unqlite.c:56961
    frame #3: 0x00005555555c72dd epoch-block-matcher`pager_commit_phase1(pPager=0x0000555555a3e664) at unqlite.c:57152
    frame #4: 0x00005555555c76c8 epoch-block-matcher`unqlitePagerCommit(pPager=0x0000555555a3e664) at unqlite.c:57290
    frame #5: 0x0000555555570a3f epoch-block-matcher`unqlite_commit(pDb=0x0000555555a406fc) at unqlite.c:6190
    frame #6: 0x00005555556857c9 epoch-block-matcher`KVPStore<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >::commit(this=0x0000555555a32fc0) at KVPStore.cpp:88
    frame #7: 0x00005555556ffc94 epoch-block-matcher`PriceEpochBlockMatcherDAO::commit(this=0x0000555555a3cc80) at PriceEpochBlockMatcherDAO.cpp:85
    frame #8: 0x00005555555cdb55 epoch-block-matcher`main(argc=1, argv=0x00007fffffffe4b8) at epoch-block-matcher.cpp:136
    frame #9: 0x00007ffff6aebc87 libc.so.6`__libc_start_main + 231
    frame #10: 0x000055555556d10a epoch-block-matcher`_start + 42

@chuckb
Copy link
Author

chuckb commented Jun 8, 2022

If I do a rollback when I get the commit failure, then upon retry, I do not get a crash, but I get a repeated server busy error.

@symisc
Copy link
Owner

symisc commented Jun 9, 2022

Hi Chuck,

This issue has been addressed on our latest bug fix. Refer to the issue: #137 for additional information. Please update to the latest patch fix.

@symisc symisc closed this as completed Jun 15, 2022
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

No branches or pull requests

2 participants