question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

IllegalArgumentException after upgrading to latest version

See original GitHub issue

Bug Report

Current Behavior

Since upgrading to 0.6.1-RELEASE we are seeing a runtime exception.

We have a test suite which tests a custom Scala wrapper of lettuce that we have built.

We are seeing some weird behaviour when we update to the latest stable version.

After starting up sbt; running our tests for the first time will not show the error, but any subsequent runs will fail before any of the tests run, throwing the below error. If we wait a minute or so and run the tests again the error will not throw the first time, before subsequently failing.

 IllegalArgumentException: java.lang.ClassCastException@57a480c4
[error]
[error]   null:-1                                      sun.reflect.GeneratedConstructorAccessor191#newInstance
[error]   DelegatingConstructorAccessorImpl.java:45    sun.reflect.DelegatingConstructorAccessorImpl#newInstance
[error]   Constructor.java:423                         java.lang.reflect.Constructor#newInstance
[error]   JfrEventRecorder.java:108                    io.lettuce.core.event.jfr.JfrEventRecorder#createEvent
[error]   JfrEventRecorder.java:48                     io.lettuce.core.event.jfr.JfrEventRecorder#record
[error]   AbstractRedisClient.java:376                 io.lettuce.core.AbstractRedisClient#initializeChannelAsync
[error]   RedisClient.java:325                         io.lettuce.core.RedisClient#connectStatefulAsync
[error]   RedisClient.java:287                         io.lettuce.core.RedisClient#connectStandaloneAsync
[error]   RedisClient.java:264                         io.lettuce.core.RedisClient#connectAsync

Input Code

We create the client like so:

RedisClient.create()

We create an async bounded connection pool like this:

AsyncConnectionPoolSupport
  .createBoundedObjectPoolAsync(
     new Supplier[java.util.concurrent.CompletionStage[StatefulRedisConnection[String, String]]] {
       def get(): ConnectionFuture[StatefulRedisConnection[String, String]] =
         client.connectAsync(StringCodec.UTF8, RedisURI.create(config.host, config.port))
     },

Expected behavior/code

Expect this error to not occur.

Environment

  • Lettuce: 6.1.0.RELEASE
  • Redis Bloom version: 2.2.5
  • Scala version: 2.13.4
  • Java version: I’ve tried 8,11 & 13
  • Sbt version: 1.5.0

Possible Solution

N/A

Additional context

This is the Redis Bloom module, running in a Docker container.

PS: Thanks for builing lettuce!

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
mcgizzlecommented, Apr 13, 2021

You were indeed correct about it being a class loaders issue, thanks for the hint!

I am straying into unfamilair teritories here, but after reading this I changed the strategy to:

Flat - No layering is used. The full classpath, as specified by the fullClasspath key of the task is loaded in the outermost layer. Consider using as an alternative to fork if any issues are experienced with ScalaLibrary or if the application requires all classes to be loaded in the same ClassLoader, which may be the case for some uses of java serialization.

And the error disapeared!

My IDE uses jdk.internal.loader.ClassLoaders while sbt uses its own class loader, which explains why it wasn’t failing there.

I’m going to do some investigation into class loaders to see what this all means…

1reaction
mp911decommented, Apr 13, 2021

Thanks for the update. It sounds a bit as if class loaders are involved. Moving on with the 6.1.1 release as we cannot do here anything short-term.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Java.lang.IllegalArgumentException At Application Start After ...
The issue can be reproduced at will with the following steps: 1. Upgrade JDBC in OC4J to 11.2.0.4 by adding JDBC jar file...
Read more >
Getting IllegalArgumentException error in factory method after ...
I am accessing test context information inside factory method. When i upgrde testNG version from 6.11 to 6.14.2, i am not able to...
Read more >
IllegalArgumentException after feature enablement
Receive IllegalArgumentException in SystemOut.log after you upgrade or migrate from a lower feature pack to a higher feature pack and enable a feature....
Read more >
Upgrading your build from Gradle 5.x to 6.0
Some plugins will break with this new version of Gradle, ... When the build is executed with --warning-mode all , the individual warnings...
Read more >
Fix list for IBM WebSphere Application Server V8.5
PH42887, Kerberos error message after upgrading to 8.5.5.20 and 9.0.5.8 ... PH42628, Update the IBM WebSphere MQ JCA resource adapter to version ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found