You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@beam.apache.org by "Kenneth Knowles (Jira)" <ji...@apache.org> on 2022/01/12 03:50:06 UTC

[jira] [Updated] (BEAM-4036) Pickler enters infinite recursion with self-referential classes

     [ https://issues.apache.org/jira/browse/BEAM-4036?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kenneth Knowles updated BEAM-4036:
----------------------------------

This Jira ticket has a pull request attached to it, but is still open. Did the pull request resolve the issue? If so, could you please mark it resolved? This will help the project have a clear view of its open issues.

> Pickler enters infinite recursion with self-referential classes
> ---------------------------------------------------------------
>
>                 Key: BEAM-4036
>                 URL: https://issues.apache.org/jira/browse/BEAM-4036
>             Project: Beam
>          Issue Type: Bug
>          Components: sdk-py-core
>            Reporter: Chuan Yu Foo
>            Priority: P3
>          Time Spent: 1h 10m
>  Remaining Estimate: 0h
>
> The pickler recurses infinitely and dies with maximum recursion limit exceeded when a module contains a self-referential class (or any class which is part of a cycle).
> Here's a minimal example: 
> {code}
> class RecursiveClass(object):
>  SELF_TYPE = None
>  def __init__(self, datum)
>    self.datum = 'RecursiveClass:%s' % datum
> RecursiveClass.SELF_TYPE = RecursiveClass
> {code}
> If this is in a module, then the pickler will enter the infinite recursion when trying to pickle any nested class in that module.
>   
> An actual example is with typing.Type, which is part of a cycle typing.Type -> type -> object -> typing.Type. If a module contains an attribute that refers to typing.Type, such as a type alias, it will trigger this bug.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)