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

Fix crashes due to illegal memory access on windows #8

Merged
merged 3 commits into from
Aug 1, 2024

Conversation

NPavie
Copy link
Collaborator

@NPavie NPavie commented Jul 26, 2024

Fixes crashes and "Illegal memory access" error reported in the pipeline app when using JNA 5.14 on windows 10+.

Crashes were caused by a GC thread, that seemed to clean PointersByReference declared in the hyphenate function while still being reserved in the JNA runner.

This PR adds

  • a stability test, that was used to pinpoint the origin of the crash
  • A fix for the crash, where the concerned pointers have been moved to object level to expand their lifetime, and have been wrapped in ThreadLocal for thread safety (in case of multithreaded calls to the native function)

Align JNA version with current version distributed in DAISY Pipeline 2.
Crashes were detected in production tests when Hyphenator is used with
the version 5.14 of JNA. See
daisy/pipeline-modules#102.
The crashes were encountered when a garbage collection thread cleaned
pointers declared in the hyphenation function. Those pointers were
possibly still reserved by the JNA running thread while being cleaned
up.

The pointers lifetime has been moved to the object level with a
ThreadLocal wrapper for thread safety.
@bertfrees
Copy link
Member

@NPavie Thanks so much!

@bertfrees bertfrees added this to the v1.14.20 milestone Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

2 participants