Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.7.0 breaks remote module execution #108

Closed
alfredodeza opened this issue Aug 27, 2019 · 4 comments
Closed

1.7.0 breaks remote module execution #108

alfredodeza opened this issue Aug 27, 2019 · 4 comments
Labels

Comments

@alfredodeza
Copy link
Contributor

The latest release (1.7.0) which includes the changes in this commit in particular: 544bcc8 is causing remote module execution to not work at all.

In gateway.py, this block:

        if isinstance(source, types.ModuleType):
            file_name = inspect.getsourcefile(source)
            if not file_name:
                source = inspect.getsource(source)
            else:
                source = None

Makes source always a None which is not correct. If/when commenting this source = None condition, a serialize error is raised:

  File "/tmp/bad/local/lib/python2.7/site-packages/execnet/gateway.py", line 135, in remote_exec
    gateway_base.dumps_internal((source, file_name, call_name, kwargs)))
  File "/tmp/bad/local/lib/python2.7/site-packages/execnet/gateway_base.py", line 1350, in dumps_internal
    return _Serializer().save(obj)
  File "/tmp/bad/local/lib/python2.7/site-packages/execnet/gateway_base.py", line 1368, in save
    self._save(obj)
  File "/tmp/bad/local/lib/python2.7/site-packages/execnet/gateway_base.py", line 1386, in _save
    dispatch(self, obj)
  File "/tmp/bad/local/lib/python2.7/site-packages/execnet/gateway_base.py", line 1471, in save_tuple
    self._save(item)
  File "/tmp/bad/local/lib/python2.7/site-packages/execnet/gateway_base.py", line 1384, in _save
    raise DumpError("can't serialize {}".format(tp))
execnet.gateway_base.DumpError: can't serialize <type 'module'>

I don't know what can I suggest here other than removing the optimization (as explained here 544bcc8#r310201906) since going back to 1.6 or anything previous to that commit, allows us to have a working application using remote modules

@nicoddemus
Copy link
Member

nicoddemus commented Aug 28, 2019

@alfredodeza thanks a lot for the detailed diagnosis.

I'm fine with removing the optimization, I'm sure the gains are negligible (@joaoe do you agree)?

@alfredodeza would you like to open a PR? I would love to merge it and make a new release. 👍

@nicoddemus nicoddemus added the bug label Aug 28, 2019
@alfredodeza
Copy link
Contributor Author

I am working on a PR. Thanks @nicoddemus for the quick action on this issue

@joaoe
Copy link

joaoe commented Aug 28, 2019

I'm fine with removing the optimization, I'm sure the gains are negligible (@joaoe do you agree)?

Yes, sure. It's really not worthwhile to add any complexity to that part of the code.

Might I also recommend that you add a test that ensure that execnet works when the source is not available remotely ? That would have saved a bug. :)

But replace the if/else with source = inspect.getsource(source)

nicoddemus added a commit to alfredodeza/execnet that referenced this issue Aug 28, 2019
@RonnyPfannschmidt
Copy link
Member

this was closed by #109

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants