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

javacpp-presets-libpostal is thread-safe or not #648

Open
shlomishasho27 opened this issue Jan 3, 2024 · 2 comments
Open

javacpp-presets-libpostal is thread-safe or not #648

shlomishasho27 opened this issue Jan 3, 2024 · 2 comments

Comments

@shlomishasho27
Copy link

Hey,

I'm utilizing javacpp-presets-libpostal for libpostal version 1.1-1.5.8.

Here's my code implementation:

override def parseAddress(str: String): Task[Map[String, String]] = {
    Resource
        .make(
            Task {
                val options = libpostal_get_address_parser_default_options()
                val address = new BytePointer(str, "UTF-8")
                libpostal_parse_address(address, options)
            }
        ) { response =>
            Task(libpostal_address_parser_response_destroy(response))
        }
        .use { response =>
            Task((0 until response.num_components().toInt).map { i =>
                val label = response.labels(i)
                val component = response.components(i)
                label.getString -> component.getString
            }.toMap)
        }
}

The code runs smoothly in my local environment. However, when deployed to a remote environment under heavy traffic, I encountered the following error:

[error occurred during error reporting (), id 0xb, SIGSEGV (0xb) at pc=0x00007f64971c3602]
# An error report file with more information is saved as:

After a brief investigation into previous issues, I came across this and this, but they seem to be older issues. I'd like to clarify whether javacpp-presets-libpostal is thread-safe or not.

@shlomishasho27
Copy link
Author

shlomishasho27 commented Jan 3, 2024

@albarrentine @saudet FYI

@saudet
Copy link

saudet commented Jan 8, 2024

libpostal is not thread-safe, see #641 (comment)

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