You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@carbondata.apache.org by GitBox <gi...@apache.org> on 2019/02/22 06:55:08 UTC

[GitHub] kunal642 opened a new pull request #3132: [CARBONDATA-3300] Fixed ClassNotFoundException when using UDF in spark-shell

kunal642 opened a new pull request #3132: [CARBONDATA-3300] Fixed ClassNotFoundException when using UDF in spark-shell
URL: https://github.com/apache/carbondata/pull/3132
 
 
   **Analysis:** 
   When a spark-shell is run a scala interpreter session is started which is the main thread for that shell. This session uses TranslatingClassLoader, therefore the UDF( $anonfun$1 in the stacktrace) that is defined would be loaded into TranslatingClassLoader.
   
   When deserialization happens an ObjectInputStream is create and the application tries to read the object, the ObjectInputStream uses a native method(sun.misc.VM.latestUserDefinedLoader() ) call to determine the ClassLoader that will be used to load the class. This native method returns URLClassLoader which is the parent of TranslatingClassLoader where the class was loaded.
   Because of this ClassNotFoundException is thrown.
   
   **Class Loader Hierarchy**
   
   - ExtClassLoader
          - AppClassLoader
                 - URLClassLoader
                         - TranslatingClassLoader 
   
   This looks like a bug in the java ObjectInputStream implementation as suggested by the following post
   https://stackoverflow.com/questions/1771679/difference-between-threads-context-class-loader-and-normal-classloader
   
   Operation | Thread | Thread ClassLoader | ClassLoader
   -- | -- | -- | --
   Register | Main | Translating | Translating
   Serialize | Main | Translating | Translating
   Deserialize | Thread-1 | Translating | URLClassLoader
   
   **Solution:** 
   Use ClassLoaderObjectInputStream to specify the class loader that should be used to load the class.
   
   Be sure to do all of the following checklist to help us incorporate 
   your contribution quickly and easily:
   
    - [ ] Any interfaces changed?
    
    - [ ] Any backward compatibility impacted?
    
    - [ ] Document update required?
   
    - [ ] Testing done
           Please provide details on 
           - Whether new unit test cases have been added or why no new tests are required?
           - How it is tested? Please attach test report.
           - Is it a performance related change? Please attach the performance test report.
           - Any additional information to help reviewers in testing this change.
          
    - [ ] For large changes, please consider breaking it into sub-tasks under an umbrella JIRA. 
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services