You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2005/08/08 08:23:12 UTC

DO NOT REPLY [Bug 36073] New: - JCI: random race conditions

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=36073>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=36073

           Summary: JCI: random race conditions
           Product: Commons
           Version: unspecified
          Platform: Other
        OS/Version: other
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Sandbox
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: plightbo@gmail.com


I'm using Jetty and configuring a custom classloader to allow for rapid
application development. I have a File[] that is ordered in the correct
dependency order. The code to construct the ClassLoader for Jetty is:

            ClassLoader parent = Thread.currentThread().getContextClassLoader();

            for (int i = 0; i < files.length; i++) {
                File file = files[i];
                parent = new CompilingClassLoader(parent, file, new
EclipseJavaCompiler());
                Field famField = parent.getClass().getDeclaredField("fam");
                famField.setAccessible(true);
                FilesystemAlterationMonitor fam = (FilesystemAlterationMonitor)
famField.get(parent);
                fam.doRun();

                Thread.sleep(500);
            }
            URLClassLoader url = new MyURLClassLoader(urls, parent);

Note the fam hack -- that has been reported in another issue. The
MyURLClassLoader is required for two reasons:
1) Jetty (actually Jasper) requires a URLClassLoader
2) The MyURLClassLoader loads classes in the standard web-app method, rather
than the standard Java way (parent last, not first)

Generally, this stuff works great. But about 30% of the time, some classes don't
get loaded by the CompilingClassLoader and manage to get loaded by the original
parent classloader (context classloader). This causes serious problems
(ClassCastExceptions, etc). 

It is clear there are some funky race conditions going on wit the way JCI kicks
off threads to do work. I think generally the code is fine, but the "first pass"
that the threads do need to be done synchrounously, rather than in the
background. I attempted to do this with "fam.doRun()", but I guess I didn't
catch everything.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org