Skip to content

Massive memory leak org.htmlunit.corejs.javascript.Arguments$ThrowTypeError #943

Open

Description

@jogger2510

Using latest 4.10.0 the plain vanilla code below leaks the above objects when running with Javascript enabled for longer periods of time. The silent error handler and exception suppression do not help. Memory leaked is about 200M / hour / JS executor. Different websites tried.

webClient = new WebClient(BrowserVersion.FIREFOX); page = webClient.getPage(url);

Activity

  1. rbri commented on Mar 14, 2025

    @rbri
    Member

    Hi @jogger2510,

    can you please provide some more details. You mean you open a page and then wait only to see the memory leak?
    Is this new in 4.10 or a older problem?

    Any chance to provide the url to let me reprouce?

  2. jogger2510 commented on Mar 14, 2025

    @jogger2510
    Author

    Hi, I am new to HtmlUnit, tried no older version.
    I just load the page as described above. You can see in VisualVM, that the JS Executor goes high on CPU and memory allocation and Objects of type org.htmlunit.corejs.javascript.Arguments$ThrowTypeError leak.

    URL that leaks fastest in my setup: https://live.euronext.com/en/product/equities/SGXZ53070850-XOSL

  3. rbri commented on Mar 15, 2025

    @rbri
    Member

    Debugging this will require some time. But as a first step we might optimize Rhino a bit to reduce the number of objects created here (see my Rhino PR)

  4. rbri commented on Mar 16, 2025

    @rbri
    Member

    minor update, there is a intervall function that fails with an error - this happens over and over again (intervall), therefore i guess this might be part of the story

  5. skyhirider commented on Mar 16, 2025

    @skyhirider
    Contributor

    Does loading an empty page clean up the javascript assigned to it?

    When I use HtmlUnit, I get a driver from a pool, do actions, load an empty page ( driver.get("data:text/html;charset=utf-8,empty" ) ) and return it to the pool.

    Found its a good way to keep sessions on standby going crazy in the background.

  6. rbri commented on Dec 1, 2025

    @rbri
    Member

    for the records, the Arguments$ThrowTypeError handling got a major change in Rhino/core-js during the last releases. I do not expect this cures the problem but it is more spec complient in this field.

  7. rbri commented on Jun 30, 2026

    @rbri
    Member

    @jogger2510 is this still a problem?

  8. jogger2510 commented on Jun 30, 2026

    @jogger2510
    Author

    In one of my applications I see 18 objects after 6 hours uptime, so if they should not be there, currently it´s a very small problem at best. However this might change, if switching to other websites.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions