Skip to content

#158 document the JDK XML limits for sitemaps and feeds - #2263

Merged
rzo1 merged 1 commit into
mainfrom
keep-xerces-sax-limits
Oct 25, 2026
Merged

rzo1 merged 1 commit into
mainfrom
keep-xerces-sax-limits

Conversation

@dpol1

@dpol1 dpol1 commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

As discussed, this replaces the Xerces restore with docs. The archetypes now pass -Djdk.xml.maxGeneralEntitySizeLimit=0 -Djdk.xml.totalEntitySizeLimit=0 to the workers. The configuration docs also cover local mode (STORM_JAR_JVM_OPTS) and the Tika fork (parser.tika.pipes.jvmargs), and the 4.0 migration notes point there.

@dpol1 dpol1 added this to the 4.0.0 milestone Oct 24, 2026
@dpol1 dpol1 added the bug label Oct 24, 2026
@dpol1 dpol1 self-assigned this Oct 24, 2026
@dpol1
dpol1 requested a review from rzo1 October 24, 2026 15:35
@rzo1

rzo1 commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

Thanks for tracking this down. I'd rather not bring Xerces back, though: 2.12.2 is from 2022, Xerces hasn't had a release since, and putting it on the classpath swaps out the SAX parser for everything in the worker, not just sitemaps and feeds.

The JDK parser can handle this with two system properties. I tried it on JDK 25.0.3 with a sitemap of 34,000 URLs and three & each. With the defaults it fails as you describe. Raising only one of the limits isn't enough, because the second one kicks in at 100,000 too. With both it parses fine:

-Djdk.xml.maxGeneralEntitySizeLimit=0 -Djdk.xml.totalEntitySizeLimit=0

So my suggestion would be to document these for the worker JVMs (topology.worker.childopts) in the configuration docs and the archetypes' crawler-conf.yaml, with a note in the 4.0 migration notes for anyone running on Java 24+.

Longer term, crawler-commons could set the two limits on its own parser in SiteMapParser.processXml() when DOCTYPEs are disallowed (the default). Without a DTD there are no custom entities, so it's safe, and then nobody needs the worker options for sitemaps. ROME would need the same for feeds.

@dpol1

dpol1 commented Oct 25, 2026

Copy link
Copy Markdown
Contributor Author

heya, makes sense, with 4.0 being a major release it's a good moment to drop Xerces. I'll rework this PR into docs for the two properties. Mainly wanted to flag the regression before the release 🙂

@dpol1
dpol1 force-pushed the keep-xerces-sax-limits branch from 2d4d90b to 6f1a37f Compare October 25, 2026 16:10
@dpol1 dpol1 changed the title #158 restore Xerces for sitemap and feed parsing #158 document the JDK XML limits for sitemaps and feeds Oct 25, 2026
@dpol1

dpol1 commented Oct 25, 2026

Copy link
Copy Markdown
Contributor Author

ping @rzo1

Without Xerces, crawler-commons, ROME and Tika use the JDK parser,
which fails on documents with many entity references. Document the
two jdk.xml options and set them in the archetypes' worker options.
@dpol1
dpol1 force-pushed the keep-xerces-sax-limits branch from 6f1a37f to 7889f17 Compare October 25, 2026 16:55
@dpol1

dpol1 commented Oct 25, 2026

Copy link
Copy Markdown
Contributor Author

I’ve expanded the wording to cover XML-based documents parsed by Tika, including OpenDocument files, and added a note for applications using Xerces classes directly.

Separately, the 4.0 migration guide is missing several breaking changes already documented elsewhere. I’ll prepare a separate docs PR to collect the upgrade steps and link to the existing module documentation.

@rzo1
rzo1 merged commit 36907a2 into main Oct 25, 2026
2 checks passed
@dpol1
dpol1 deleted the keep-xerces-sax-limits branch October 25, 2026 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants