Issue Details (XML | Word | Printable)

Key: HADOOP-4467
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Blocker Blocker
Assignee: Chris K Wensel
Reporter: Chris K Wensel
Votes: 0
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
Hadoop Common

SerializationFactory should use current context ClassLoader

Created: 20/Oct/08 10:31 PM   Updated: 04/Nov/08 06:48 PM
Return to search
Component/s: None
Affects Version/s: 0.18.1, 0.19.0
Fix Version/s: 0.18.2

Time Tracking:
Not Specified

File Attachments:
  Size
Text File Licensed for inclusion in ASF works hadoop-4467-v2.patch 2008-10-20 11:58 PM Chris K Wensel 2 kB
Text File Licensed for inclusion in ASF works hadoop-4467.patch 2008-10-20 11:20 PM Chris K Wensel 1 kB

Release Note: SerializationFactory now uses the current context ClassLoader allowing for user supplied Serialization instances.
Resolution Date: 23/Oct/08 03:53 AM


 Description  « Hide
SerializationFactory#add calls Class.forName without a ClassLoader instance. This prevents user-space Serialization classes from being loaded.

The resulting ClassNotFoundException is eaten after being logged, and a NPE is thrown further down the line when a Serializer is requested.



 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Chris K Wensel added a comment - 20/Oct/08 11:10 PM
I probably should have phrased this one differently, but it does seem to be standard practice to provide the context classloader when calling Class.forName.

I can submit a patch with the one line change. but I do not know if there should (or even could be) an accompanying unit test for this. please advise.


Chris K Wensel added a comment - 20/Oct/08 11:11 PM
added 0.19 as an affected version

Chris K Wensel added a comment - 20/Oct/08 11:20 PM
initial attempt, without unit tests

Owen O'Malley added a comment - 20/Oct/08 11:46 PM
Wouldn't it be better to use the class loader associated with the configuration rather than the current thread? Basically, use
conf.getClassByName(name);

Clearly the conf for the serializer would need to be saved from the constructor.


Chris K Wensel added a comment - 20/Oct/08 11:48 PM
agreed.

Chris K Wensel added a comment - 20/Oct/08 11:58 PM
delegates classloading back to Configuration

Chris K Wensel added a comment - 21/Oct/08 12:00 AM
delegates back to Configuration

Tom White added a comment - 21/Oct/08 08:03 PM
+1

Chris K Wensel added a comment - 22/Oct/08 07:02 AM
All but org.apache.hadoop.fs.TestLocalDirAllocator tests pass.

I think this is unrelated:
shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory


Chris K Wensel added a comment - 22/Oct/08 07:21 AM
via ant test-patch...

seems to be down on lack of tests. unsure, per previous comment, how to test classloader issues.

[exec] -1 overall.
[exec]
[exec] +1 @author. The patch does not contain any @author tags.
[exec]
[exec] -1 tests included. The patch doesn't appear to include any new or modified tests.
[exec] Please justify why no tests are needed for this patch.
[exec]
[exec] +1 javadoc. The javadoc tool did not generate any warning messages.
[exec]
[exec] +1 javac. The applied patch does not increase the total number of javac compiler warnings.
[exec]
[exec] +1 findbugs. The patch does not introduce any new Findbugs warnings.
[exec]


Arun C Murthy added a comment - 23/Oct/08 03:53 AM
I just committed this. Thanks, Chris!

Hudson added a comment - 23/Oct/08 09:56 PM
Integrated in Hadoop-trunk #640 (See http://hudson.zones.apache.org/hudson/job/Hadoop-trunk/640/)
. SerializationFactory now uses the current context ClassLoader allowing for user supplied Serialization instances. Contributed by Chris Wensel.