iohub / ahocorasick

A fast and memory efficient implementation of aho-corasick algorithm based on double-array trie (cedar), supports visualizing structure via graphviz.
GNU General Public License v2.0
115 stars 20 forks source link

Issues with concurrency #18

Closed YeruchamB closed 8 months ago

YeruchamB commented 3 years ago

I'm getting transient errors when trying to create multiple automaton in different threads. I keep getting panic: runtime error: index out of range [-x] errors that pop up in different places while building the automatons.

When you state that "This package is not thread safe if there is one goroutine doing insertions or deletions.", does that mean even when each thread is accessing a different automaton?

iohub commented 8 months ago

You can add a mutex lock wrap for concurrency usage.