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

IllegalStateException: A thread that is executing an IO task has attempted to await the completion of itself. This is a deadlock. #161

Open
Michael-A-McMahon opened this issue Dec 3, 2024 · 0 comments

Comments

@Michael-A-McMahon
Copy link
Member

Michael-A-McMahon commented Dec 3, 2024

After updating to 1.3.0 users may see the error listed in the title of this issue. In most cases it can be resolved by setting DEFAULT_LOB_PREFETCH_SIZE to the value of 1000000000 (1GB).

The DEFAULT_LOB_PREFETCH_SIZE may be configured using ConnectionFactoryOptions.Builder:

ConnectionFactory example() {
  ConnectionFactoryOptions options =
    ConnectionFactoryOptions.builder()
      // Allow queries to allocate up to 1GB for each BLOB/CLOB value
      .option(OracleR2dbcOptions.DEFAULT_LOB_PREFETCH_SIZE, "1000000000")
      // Configure other options as usual
      .option(DRIVER, "oracle")
      .option(HOST, "localhost")
      .option(PORT, 1521)
      .option(DATABASE, "dbName")
      .option(USER, System.getenv("DB_USER"))
      .option(PASSWORD, System.getenv("DB_PASSWORD"))
      .build();

  return ConnectionFactories.get(options);
}

The option may also be configured as a URL parameter:

ConnectionFactory example() {
  ConnectionFactoryOptions options = ConnectionFactoryOptions.parse(
    "r2dbc:oracle://localhost:1521/dbName?oracle.jdbc.defaultLobPrefetchSize=1000000000")
    .mutate()
    // Configure other options as usual
    .option(USER, System.getenv("DB_USER"))
    .option(PASSWORD, System.getenv("DB_PASSWORD"))
    .build();
  return ConnectionFactories.get(options);
}

More resources on configuring a prefetch and consuming LOBs:
Oracle R2DBC Documentation
Optimized processing of your 'not-so-large' Large Objects (LOBs) with Value LOBs

The root cause of this issue is a defect in the 23.7 release of Oracle JDBC (bug #37347553). I have already made a fix for that and will request for its inclusion in the 23.8 release.

In Oracle R2DBC, there is a defect in how the default LOB prefetch size is set. It is set to 1MB, when it should be set to 1GB. A fix for that will go into the next Oracle R2DBC release. Once it is resolved, explicitly setting 1GB will no longer be necessary.

@Michael-A-McMahon Michael-A-McMahon changed the title IllegalStateException: A THREAD THAT IS EXECUTING AN IO TASK HAS ATTEMPTED TO AWAIT THE COMPLETION OF ITSELF. THIS IS A DEADLOCK. IllegalStateException: A thread that is executing an IO task has attempted to await the completion of itself. This is a deadlock. Dec 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant