Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-6767

Cannot load user class on local environment

    XMLWordPrintableJSON

Details

    • Patch, Important

    Description

      There is a bug in Flink 1.2.1 that results in a "cannot load user class" exception even when the class is available in the current class loader of the thread running the job. The problem arises when you execute a Flink job on a local environment inside an Ignite 2.0 node. This happens on possibly all other versions of Flink and Ignite.

      This bug was discussed in [1], and a fix was proposed in [2].

      In summary, the fix requires replacing line 298 in BlobLibraryCacheManager.java [3] for:

      this.classLoader = new FlinkUserCodeClassLoader(libraryURLs, Thread.currentThread().getContextClassLoader());
      

      A repository with a complete test case reproducing the error is found in [4]. The idea behind the code is being able to run Flink jobs in a collocated way (ie, on the node where the data is stored), minimizing network traffic and thus improving the performance.

      The README file contains details on how to run it and the resulting exception:

      org.apache.flink.streaming.runtime.tasks.StreamTaskException: Cannot load user class: com.test.Source
      ClassLoader info: URL ClassLoader:
      Class not resolvable through given classloader.
      

      [1] http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/BUG-Cannot-Load-User-Class-on-Local-Environment-td12799.html

      [2] http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/BUG-Cannot-Load-User-Class-on-Local-Environment-tp12799p13376.html

      [3] https://github.com/apache/flink/blob/release-1.2/flink-runtime/src/main/java/org/apache/flink/runtime/execution/librarycache/BlobLibraryCacheManager.java#L298

      [4] https://github.com/Dromit/FlinkTest

      Attachments

        Activity

          People

            Unassigned Unassigned
            Dromit Matt
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:

              Time Tracking

                Estimated:
                Original Estimate - 1h
                1h
                Remaining:
                Remaining Estimate - 1h
                1h
                Logged:
                Time Spent - Not Specified
                Not Specified