HTML::Parser hangs at EOF on unterminated start tag
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 78/100
Research direction
Start at the shared Java-backed HTMLParser.parseHtml() and flushBufferedAtEof() paths described in the issue, then reproduce with the unterminated <foo a=b input under both JVM and interpreter backends. Verify that eof() terminates, emits the remaining malformed input, and no longer retries an unchanged buffer; run HTML-Tree 5.07's t/parsefile.t to confirm the timeout is resolved.
Written by the indexing model from the issue text.
Description
Summary
PerlOnJava hangs indefinitely when the Java-backed HTML::Parser reaches EOF with an unterminated start tag. This causes HTML-Tree 5.07's t/parsefile.t to time out.
Reproduction
use HTML::TreeBuilder;
open my $fh, '>', '/tmp/input.html' or die $!;
print {$fh} "<foo a=b\n";
close $fh;
my $tree = HTML::TreeBuilder->new;
print "before parse_file\n";
$tree->parse_file('/tmp/input.html');
print "after parse_file\n";
With PerlOnJava 0.7.0-dev, both commands hang until killed:
timeout 30 ./jperl probe_html_parsefile.pl
timeout 30 ./jperl --interpreter probe_html_parsefile.pl
Changing the input to <foo a=b> completes successfully.
Observed CPAN failure
HTML-Tree 5.07 passes through t/parse.t, then stalls in t/parsefile.t until the CPAN tester's soft timeout. The archived failure log is:
/tmp/cpan_random_logs/20260925-103132-20451/failures/HTML-TreeBuilder--from--HTML-TreeBuilder.log
System Perl passes the complete distribution suite: 23 files and 989 tests.
Root cause
HTMLParser.parseHtml() correctly buffers an incomplete tag at EOF, but flushBufferedAtEof() repeatedly feeds that unchanged buffer back into parseHtml(). The parser re-buffers the same input, so the EOF flush loop never makes progress.
The problem is in the shared Java-backed parser and reproduces under both the JVM and interpreter backends; it is not specific to HTML::TreeBuilder or to file I/O.
Expected behavior
eof() should terminate and emit the remaining malformed input according to Perl HTML::Parser semantics, without retrying an unchanged buffer forever.
- Dominant language
- Perl
- Stars
- 64
- Forks
- 6
- Avg merge
- 4h 53m
- Merged PRs (30d)
- 165
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from fglock/PerlOnJava
-
area:cpan-port area:unicode bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
fglock/PerlOnJava#1341 ·
Maintainers usually reply within 2 days
-
Difficulty 3/5 1-2 days Newbie friendliness 74/100
fglock/PerlOnJava#1524 ·
Maintainers usually reply within 2 days
-
area:backend area:runtime bug
Difficulty 4/5 3-5 days Newbie friendliness 65/100
fglock/PerlOnJava#1523 ·
Maintainers usually reply within 2 days
-
area:backend area:cpan-port bug
Difficulty 3/5 1-2 days Newbie friendliness 76/100
fglock/PerlOnJava#1522 ·
Maintainers usually reply within 2 days
-
area:backend area:io area:unicode bug
Difficulty 4/5 3-5 days Newbie friendliness 52/100
fglock/PerlOnJava#1520 ·
Maintainers usually reply within 2 days
All issues in fglock/PerlOnJava
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 86/100
openfoodfacts/openfoodfacts-server#14724 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
rubocop/ruby-style-guide#982 ·
-
question
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 75/100
-
Bug Priority
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
canonical/chisel-releases#1235 ·
Maintainers usually reply within 1 day