Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

HTML::Parser hangs at EOF on unterminated start tag

Open
#1,528 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
java, perl
Domain
backend

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

area:backend area:cpan-port area:parser area:runtime bug

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

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from fglock/PerlOnJava

All issues in fglock/PerlOnJava

Similar issues

More Perl issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.