freelawproject / eyecite

Find legal citations in any block of text
https://freelawproject.github.io/eyecite/
BSD 2-Clause "Simplified" License
114 stars 27 forks source link

HyperScan ScratchInUseError #179

Open sentry-io[bot] opened 2 months ago

sentry-io[bot] commented 2 months ago

This one has occurred once so far:

Sentry Issue: COURTLISTENER-75S

ScratchInUseError: error code -10
(4 additional frame(s) were not displayed)
...
  File "cl/search/views.py", line 544, in show_results
    render_dict.update(do_search(request.GET.copy()))
  File "cl/search/views.py", line 222, in do_search
    query_citation = get_query_citation(cd)
  File "cl/lib/search_utils.py", line 102, in get_query_citation
    citations = get_citations(cd["q"], tokenizer=HYPERSCAN_TOKENIZER)

Filed by: @albertisfu

mlissner commented 2 months ago

Yikes, no results on Google:

image

ERosendo commented 1 month ago

While debugging a separate issue related to hyperscan, I stumbled upon a docstring that explains this error:

/**
 * The scratch region was already in use.
 *
 * This error is returned when Hyperscan is able to detect that the scratch
 * region given is already in use by another Hyperscan API call.
 *
 * A separate scratch region, allocated with @ref hs_alloc_scratch() or @ref
 * hs_clone_scratch(), is required for every concurrent caller of the Hyperscan
 * API.
 *
 * For example, this error might be returned when @ref hs_scan() has been
 * called inside a callback delivered by a currently-executing @ref hs_scan()
 * call using the same scratch region.
 *
 * Note: Not all concurrent uses of scratch regions may be detected. This error
 * is intended as a best-effort debugging tool, not a guarantee.
 */
#define HS_SCRATCH_IN_USE       (-10)

Here's the description of a scratch-space from the dev-reference page:

mlissner commented 1 month ago

Huh, weird. I guess this means we can do a retry as our best hope? I'm not sure how we're accessing the scratch region from multiple threads?

sentry-io[bot] commented 1 week ago

Related:

Sentry Issue: COURTLISTENER-774

Filed by: @albertisfu