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

Bookmark Separator appears inside Bookmarks #882

Closed
orthogonal3 opened this issue Jul 22, 2021 · 1 comment
Closed

Bookmark Separator appears inside Bookmarks #882

orthogonal3 opened this issue Jul 22, 2021 · 1 comment
Assignees

Comments

@orthogonal3
Copy link

Bookmark separator sequence of BS can appear within a normal bookmark string, causing a bookmark string to be split in half erroneously.

Expected Behavior

Transaction should follow causal chain established by the bookmark.

Current Behavior

Bookmark inter

Bookmarks returned from Neo4j with the following format work just fine:

FB:kcwQ1ap/pGGeSZC7gxLjSLCYq8kBQ5A=

Bookmarks returned from Neo4j with the following format will fail:

FB:kcwQ1ap/pGGeSZC7gxLjSLCYq8kBSpA=

These transactions will fail with an error message similar to:

Could not open Neo4j Session for transaction; nested exception is org.neo4j.driver.exceptions.ClientException: Supplied bookmarks 'pA=' does not conform to pattern {database_id}:{tx_id}.

The failing bookmark has the character sequence “BS” contained within it. By co-incidence, this is the same character sequence used by the bolt driver as a “Bookmark Separator” – which is used to combine and then split multiple bookmarks (BoltDriver.java line 409, in the method bookmarksFromStrings(…)).

This means that a single bookmark that contains the two letters “BS” is erroneously split in half – causing an invalid bookmark to be sent to the database, resulting in the observed error.

Environment

Database: Neo4J 4.2.3
Bolt Driver: neo4j-ogm-bolt-driver:3.2.24

Steps to Reproduce

Set up a test application using bookmarks to establish a causal chain.
On receipt of a bookmark, use that bookmark for subsequent transaction.
Through repeated testing, a failure can be observed.

Possible Resolutions

Option 1: Use a Bookmark Separator that cannot be contained within a genuine bookmark.
Option 2: Escape/un-escape any occurrence of the Bookmark Separator when combining/splitting bookmarks

@meistermeier
Copy link
Collaborator

Thanks for reporting this. Yes, the usage of just BS was a little bit naive.

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

No branches or pull requests

2 participants