[ 
https://issues.apache.org/jira/browse/HADOOP-11656?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14349314#comment-14349314
 ] 

Sangjin Lee commented on HADOOP-11656:
--------------------------------------

To fill folks in on the application classloader, the application classloader 
works both with MR jobs (containers) *and* RunJar clients. The base classloader 
itself is refactored into hadoop-common, and made general to allow it to be 
plugged into any situation. The current users of the application classloader 
happen to be the MR tasks and RunJar.

The application classloader (started by Tom White and worked on by me) is 
essentially the same idea as the webapp classloader in servlet containers (e.g. 
jetty): inverted (parent-last) classloading. As such, it's a fairly well-known 
and well-tested classloading scheme (people don't normally run into 
classloading issues with servlet containers). The actual subtleties lie in how 
and when the classloader is started and shut down (as well as plugged into the 
thread context classloader). That's where most of the bugs happen.

We are using the application classloader with success; much more so on the MR 
tasks than on the client-side. Doesn't mean that there are no issues. There 
were several issues we found and fixed, and I suspect there may be more. But by 
and large users who enabled the application classloaders are using it fine.

As passionate I am about OSGi, I do think that transitioning to OSGi would be a 
major disruptive undertaking. It would have a pretty deep impact the way we 
build and organize code, and depending on how much we expose the OSGi elements 
to the users, a fairly steep learning curve to the users. And of course, using 
OSGi can mean many things, ranging from a minimal model (where user code 
doesn't have to be OSGi-compliant) to a very intrusive model (where everyone 
must be in an OSGi bundle). I'd be happy to work together with anyone who's 
willing to look at OSGi-based proposals...

But IMO the current application classloader might be a practical compromise we 
can make work for Hadoop by default. My 2 cents.

> Classpath isolation for downstream clients
> ------------------------------------------
>
>                 Key: HADOOP-11656
>                 URL: https://issues.apache.org/jira/browse/HADOOP-11656
>             Project: Hadoop Common
>          Issue Type: New Feature
>            Reporter: Sean Busbey
>            Assignee: Sean Busbey
>              Labels: classloading, classpath, dependencies, scripts, shell
>
> Currently, Hadoop exposes downstream clients to a variety of third party 
> libraries. As our code base grows and matures we increase the set of 
> libraries we rely on. At the same time, as our user base grows we increase 
> the likelihood that some downstream project will run into a conflict while 
> attempting to use a different version of some library we depend on. This has 
> already happened with i.e. Guava several times for HBase, Accumulo, and Spark 
> (and I'm sure others).
> While YARN-286 and MAPREDUCE-1700 provided an initial effort, they default to 
> off and they don't do anything to help dependency conflicts on the driver 
> side or for folks talking to HDFS directly. This should serve as an umbrella 
> for changes needed to do things thoroughly on the next major version.
> We should ensure that downstream clients
> 1) can depend on a client artifact for each of HDFS, YARN, and MapReduce that 
> doesn't pull in any third party dependencies
> 2) only see our public API classes (or as close to this as feasible) when 
> executing user provided code, whether client side in a launcher/driver or on 
> the cluster in a container or within MR.
> This provides us with a double benefit: users get less grief when they want 
> to run substantially ahead or behind the versions we need and the project is 
> freer to change our own dependency versions because they'll no longer be in 
> our compatibility promises.
> Project specific task jiras to follow after I get some justifying use cases 
> written in the comments.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to