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

Class Loading Issue with Custom ClassLoader in Flowable Engine 7.1.0 #4001

Closed
anthologia opened this issue Dec 19, 2024 · 1 comment
Closed

Comments

@anthologia
Copy link

Environment

  • Flowable Engine version: 7.1.0
  • Using custom ClassLoader implementation

Issue Description
I've encountered an unexpected behavior with class loading when using a custom ClassLoader hierarchy with Flowable Engine. The engine appears to retain references to class instances from removed ClassLoaders, even after new versions of the same class are loaded through a different ClassLoader.

ClassLoader Structure and Steps to Reproduce

  1. Initial setup with custom ClassLoader hierarchy:
/root custom loader
   /child custom loader1
   /child custom loader2
      /child custom loader2-1
  1. Load class A in child custom loader1 (let's call this instance address 11111):
/root custom loader
   /child custom loader1
      - A class (11111)
   /child custom loader2
      /child custom loader2-1
  1. Start a process instance with an instance of class A (11111) in variables.
  2. Remove child custom loader1 from the hierarchy:
/root custom loader
   /child custom loader2
      /child custom loader2-1
  1. Create child custom loader3 and load class A again (let's call this instance address 22222):
/root custom loader
   /child custom loader2
      /child custom loader2-1
   /child custom loader3
      - A class (22222)
  1. Start a new process instance with an instance of class A (22222) in variables.

Expected Behavior
When retrieving class A through variables in the second process instance, it should return the instance with address 22222 (loaded from child custom loader3).

Actual Behavior

  • When accessing class A through processEngineConfiguration's classLoader (root custom loader), it correctly returns the class with address 22222.
  • However, when accessing an instance of class A through process variables, it unexpectedly returns the instance with address 11111, which was loaded from the now-removed child custom loader1.

I think it suggests that Flowable Engine might be caching class instances or maintaining references to them even after their ClassLoader has been removed from the hierarchy. This could potentially lead to unexpected behavior in applications that rely on dynamic class loading.

Questions

  1. Is this expected behavior?
  2. If not, I would like to contribute to fixing this if it's an issue. Which areas of code should I look into first?
@anthologia
Copy link
Author

I've investigated both Flowable's reflection code and my CustomClassLoader and found that this behavior was due to an incorrect parent ClassLoader configuration in my ChildCustomLoader.

I apologize for any confusion this may have caused.
Thanks.

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