Pig
  1. Pig
  2. PIG-2815

class loader management in PigContext

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.9.0
    • Fix Version/s: 0.11
    • Component/s: impl
    • Labels:
      None

      Description

      The way PigContext.classloader and resolveClassName() are managed can lead to strange class loading issues, especially when not all register statements are at the top (example in the first comment).

      Two factors contribute to this: sometimes only one of them and sometimes together:

      1. a new classloader (CL) is created after registering each jar.
        • but the new jar's parent is the root CL rather than previous CL, effectively throwing previous CL away.
      2. resolveClassName() caches classes based on just the name
        • A class is not defined by name alone. Classes loaded by two different unrelated CLs are different objects even if both extract the class from same physical jar file.
        • because of (1), the cached class is not necessarily same as the class that would be loaded based on 'current' CL

      having different class objects for same class have many subtle side effects. e.g. there would be two instances of static variables.

      I think both should be fixed.. thought fixing one of them might be good enough in many cases. I will add a patch.

      1. PIG-2815-branch-0.9.patch
        7 kB
        Raghu Angadi
      2. PIG-2815-branch-0.9.patch
        7 kB
        Raghu Angadi
      3. PIG-2815.patch
        3 kB
        Raghu Angadi
      4. PIG-2815.patch
        6 kB
        Raghu Angadi

        Activity

        Raghu Angadi created issue -
        Raghu Angadi made changes -
        Field Original Value New Value
        Attachment PIG-2815.patch [ 12536343 ]
        Raghu Angadi made changes -
        Attachment PIG-2815.patch [ 12536600 ]
        Ashutosh Chauhan made changes -
        Assignee Raghu Angadi [ rangadi ]
        Raghu Angadi made changes -
        Attachment PIG-2815-branch-0.9.patch [ 12536893 ]
        Raghu Angadi made changes -
        Attachment PIG-2815-branch-0.9.patch [ 12537029 ]
        Cheolsoo Park made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Bill Graham made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Raghu Angadi
            Reporter:
            Raghu Angadi
          • Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development