Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid virtual thread pinning in procedure calling #34133

Open
AgilAghamirzayev opened this issue Dec 20, 2024 · 0 comments
Open

Avoid virtual thread pinning in procedure calling #34133

AgilAghamirzayev opened this issue Dec 20, 2024 · 0 comments
Assignees
Labels
in: data Issues in data modules (jdbc, orm, oxm, tx) type: enhancement A general enhancement
Milestone

Comments

@AgilAghamirzayev
Copy link

AgilAghamirzayev commented Dec 20, 2024

Virtual thread pinning in procedure calling

Hi, I am using Java 21, spring boot 3.3.2

When I enable virtual threads and -Djdk.tracePinnedThreads=short I got virtual thread pinning and deadlock my requests.

The pinning log :

Thread[#179,ForkJoinPool-1-worker-28,5,CarrierThreads]
org.springframework.jdbc.core.simple.AbstractJdbcCall.compile(AbstractJdbcCall.java:298) <== monitors:1

I review the code there used synchronized in method level. Could we change it to java locking library.

public final synchronized void compile() throws InvalidDataAccessApiUsageException {
		if (!isCompiled()) {
			if (getProcedureName() == null) {
				throw new InvalidDataAccessApiUsageException("Procedure or Function name is required");
			}
			try {
				this.jdbcTemplate.afterPropertiesSet();
			}
			catch (IllegalArgumentException ex) {
				throw new InvalidDataAccessApiUsageException(ex.getMessage());
			}
			compileInternal();
			this.compiled = true;
			if (logger.isDebugEnabled()) {
				logger.debug("SqlCall for " + (isFunction() ? "function" : "procedure") +
						" [" + getProcedureName() + "] compiled");
			}
		}
	}
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Dec 20, 2024
@jhoeller jhoeller added in: data Issues in data modules (jdbc, orm, oxm, tx) type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Dec 21, 2024
@jhoeller jhoeller self-assigned this Dec 21, 2024
@jhoeller jhoeller added this to the 6.2.2 milestone Dec 21, 2024
@jhoeller jhoeller changed the title Virtual thread pinning in procedure calling Avoid virtual thread pinning in procedure calling Dec 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: data Issues in data modules (jdbc, orm, oxm, tx) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

3 participants