Skip to content

Tolerate creation of InnocuousThreads - to facilitate use of java.lang.ref.Cleaner #77788

@ChrisHegarty

Description

@ChrisHegarty

During the course of a separate PR [1], it was observed that java.lang.ref.Cleaner::create checks that the caller is allowed to create or start a thread - throws SecurityException if not. This is as designed and specified in the Java SE specification. The aforementioned PR [1] runs afoul of this, since it would appear to be the first time that Cleaner is being used in the code base or a transitive dependency.

By default, and with a security manager installed, the JDK implementation will create a new InnocuousThread to execute the clean actions of a Cleaner. With the phased migration away from finalizers, it is likely that more libraries will start to adopt j.l.ref.Cleaner. The ES security manager should tolerate its use without the need for each and every codebase to be granted an explicit permission.

When this issue is resolved, the aforementioned PR [1] can remove its changes that relate to dealing with the security manager aspects of granting and checking modifyInnocuousThread.

[1] relates #77012

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions