use counter instead of pointer cast for obj id#9
Open
seeduvax wants to merge 1 commit intostetre:masterfrom
Open
use counter instead of pointer cast for obj id#9seeduvax wants to merge 1 commit intostetre:masterfrom
seeduvax wants to merge 1 commit intostetre:masterfrom
Conversation
On my x86_64 Debian 12 host, using lua5.4: - object Ids are not well passed back from lua to C. - created objects can't be found, making errors like "invalid ring buffer reference" It seems it is because lua numbers are double and the way big 64bits uintptr_t values are assigned ans cast to/from lua double does not preserve identity (in particular when pointers value are starting with 0xff, making negative value in lua side). To solve this issue, key values are now generated with simple counters starting from specific remarkable values accoring type (128, 1024, 2048, etc). Since I do not expect so much keys shall be created from a single script, I do not expect the counters will increase so much improper values like the pointers can be reached. To be considered: protect counter increments with mutex. Did not implemented yet since my understanding of luajack is new object shall be created from the main thread before jack.activate(), so such mutex appears to be useless.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On my x86_64 Debian 12 host, using lua5.4:
To solve this issue, key values are now generated with simple counters starting from specific remarkable values accoring type (128, 1024, 2048, etc). Since I do not expect so much keys shall be created from a single script, I do not expect the counters will increase so much improper values like the pointers can be reached.
To be considered: protect counter increments with mutex. Did not implemented yet since my understanding of luajack is new object shall be created from the main thread before jack.activate(), so such mutex appears to be useless.