python-hyperscan icon indicating copy to clipboard operation
python-hyperscan copied to clipboard

Seeing "ScratchInUseError('error code -10')" when run hyperscan

Open YuehanZong opened this issue 8 months ago • 1 comments

Hi team,

We are running following code to scan the text extracted from files, and getting this ScratchInUseError('error code -10'):

# Initialize db at the beginning only once.
db = hyperscan.Database()
db.compile(expressions=expressions, ids=ids, elements=len(patterns), flags=flags)

# Been called every time there's new file coming
hs_context = {"results": []}
db.scan(text, match_event_handler=self._on_match, context=hs_context)

The database is initialized only once at the beginning, and each time we encountered a file we call db.scan() method for hyperscan.

Wondering if there's a way to explicitly create new scratch space every time before we call db.scan(), and also free-up the space after scan completed? Thanks

YuehanZong avatar Apr 24 '25 19:04 YuehanZong