Conversation
…bapps#2279) goment fills its global parse/format tables lazily with no sync, so the first burst of concurrent scrapers races reader against writer and can call a nil func value -> SIGSEGV, killing the whole server (TransVR date parse). Warm both tables once in scrape init; parse Grooby-network dates through a shape-checked helper returning "" on garbage (transvr, groobyvr); wrap both runScrapers spawn sites in recover() so one bad site logs-and-skips instead of taking down the run. Assisted-By: muse-spark-1.3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2279.
Running all scrapers, the whole server died with SIGSEGV inside goment (
parse.go:403, viapkg/scrape/transvr.go:64). Root cause is a data race, not a bad date string:goment.Newfills its global parse/format tables lazily with no mutex orsync.Once, so the first burst of concurrent scraper goroutines collides reader-against-writer and can call a nil function value. I confirmed it both ways — 4,172 malformed inputs through the exact call never panic, while 64 goroutines under-racetrip the detector immediately. Single-scraper runs survive because the tables finish building before concurrency starts.Changes:
pkg/scrape/date_parse.go: packageinitwarms both goment tables once, single-threaded, before any goroutine runs. After that they are read-only, so this covers all 30+goment.Newcall sites process-wide.parseGroobyDate()only forwardsMonth D, YYYY-shaped strings to goment and returns""otherwise; wired intotransvr.goandgroobyvr.go(identical code, identical latent crash).pkg/tasks/content.go: newrunScraperSafe()wraps both scraper spawn sites withrecover()— one bad site logsscraper X panicked and was skippedand the run continues.wg.Donestays deferred inside each scraper, so batch accounting is unaffected.Tests:
pkg/scrape/date_parse_test.go(valid dates format, garbage yields"") andpkg/tasks/scrape_safe_test.go(panicking fake scraper is contained, counter returns to zero). Both suites green; fullgo build ./...clean.