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

protobuf 3.2.0 not working but protobuf 3.1.0.post1 is #30

Open
mreinhardt opened this issue Feb 10, 2017 · 6 comments
Open

protobuf 3.2.0 not working but protobuf 3.1.0.post1 is #30

mreinhardt opened this issue Feb 10, 2017 · 6 comments

Comments

@mreinhardt
Copy link

mreinhardt commented Feb 10, 2017

Getting the following stack trace error when trying to start up an application that's using riemann-client:

[2017-02-10 22:49:19 +0000] [3567] [INFO] Worker exiting (pid: 3567)
[2017-02-10 22:49:19 +0000] [3568] [ERROR] Exception in worker process
Traceback (most recent call last):
  File "/MyCo/my.app/env/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 557, in spawn_worker
    worker.init_process()
  File "/MyCo/my.app/env/local/lib/python2.7/site-packages/gunicorn/workers/ggevent.py", line 190, in init_process
    super(GeventWorker, self).init_process()
  File "/MyCo/my.app/env/local/lib/python2.7/site-packages/gunicorn/workers/base.py", line 126, in init_process
    self.load_wsgi()
  File "/MyCo/my.app/env/local/lib/python2.7/site-packages/gunicorn/workers/base.py", line 136, in load_wsgi
    self.wsgi = self.app.wsgi()
  File "/MyCo/my.app/env/local/lib/python2.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
    self.callable = self.load()
  File "/MyCo/my.app/env/local/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 65, in load
    return self.load_wsgiapp()
  File "/MyCo/my.app/env/local/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
    return util.import_app(self.app_uri)
  File "/MyCo/my.app/env/local/lib/python2.7/site-packages/gunicorn/util.py", line 357, in import_app
    __import__(module)
  File "/MyCo/my.app/env/local/lib/python2.7/site-packages/gevent/builtins.py", line 93, in __import__
    result = _import(*args, **kwargs)
  File "/MyCo/my.app/env/local/lib/python2.7/site-packages/my/app/wsgi.py", line 3, in <module>
    from my.app.app import application, set_logger
  File "/MyCo/my.app/env/local/lib/python2.7/site-packages/gevent/builtins.py", line 93, in __import__
    result = _import(*args, **kwargs)
  File "/MyCo/my.app/env/local/lib/python2.7/site-packages/my/app/app.py", line 16, in <module>
    from my.app.riemann import get_alerting_events, get_events                                                                        
  File "/MyCo/my.app/env/local/lib/python2.7/site-packages/gevent/builtins.py", line 93, in __import__
    result = _import(*args, **kwargs)
  File "/MyCo/my.app/env/local/lib/python2.7/site-packages/my/app/riemann.py", line 7, in <module>
    from riemann_client.client import Client
  File "/MyCo/my.app/env/local/lib/python2.7/site-packages/gevent/builtins.py", line 93, in __import__
    result = _import(*args, **kwargs)
  File "/MyCo/my.app/env/local/lib/python2.7/site-packages/riemann_client/client.py", line 27, in <module>
    import riemann_client.riemann_pb2
  File "/MyCo/my.app/env/local/lib/python2.7/site-packages/gevent/builtins.py", line 93, in __import__
    result = _import(*args, **kwargs)
  File "/MyCo/my.app/env/local/lib/python2.7/site-packages/riemann_client/riemann_pb2.py", line 10, in <module>
    from riemann_client.riemann_pb2_py2 import (Event, Msg, Query, Attribute)
  File "/MyCo/my.app/env/local/lib/python2.7/site-packages/gevent/builtins.py", line 93, in __import__
    result = _import(*args, **kwargs)
  File "/MyCo/my.app/env/local/lib/python2.7/site-packages/riemann_client/riemann_pb2_py2.py", line 32, in <module>
    options=None),
  File "/MyCo/my.app/env/local/lib/python2.7/site-packages/google/protobuf/descriptor.py", line 494, in __new__
    _message.Message._CheckCalledFromGeneratedFile()
TypeError: Descriptors should not be created directly, but only retrieved from their parent.

This is happening with protobuf 3.2.0 only. When I manually move the protobuf 3.1.0.post1 site-package from my last build into my app env everything works as expected.

I notice that the wheels are built differently and vary greatly in size as well:

-rw-r--r--   347537 bytes   protobuf-3.1.0.post1-py2.py3-none-any.whl

vs

-rw-r--r--   5618195 bytes   protobuf-3.2.0-cp27-cp27mu-manylinux1_x86_64.whl

Does the riemann-client need to be forced to use protobuf < 3.2 or is there a problem outside the scope of riemann-client that I'm not recognizing?

@mreinhardt mreinhardt changed the title protobuf 3.2 not working but protobuf 3.1 is protobuf 3.2.0 not working but protobuf 3.1.0.post1 is Feb 10, 2017
@mreinhardt
Copy link
Author

Note: I was able to get around this by pinning protobuf==3.1.0.post1 in my setup.py

@borntyping
Copy link
Owner

This was written long before protobuf 3, so unfortunately I don't know what would cause this specific error. I'll look into it if I get a chance, but for the time being I'll gladly accept a PR to depend on rotobuf<=3.1.0.post1 or that fixes the issue.

@mreinhardt
Copy link
Author

mreinhardt commented Feb 13, 2017

Thanks, I'll go ahead and make the PR. I'll also see if I can find some other verification of the root cause of the issue and whether it's needed for Python 3 also as we're running 2.7.

@aduston
Copy link

aduston commented Feb 27, 2017

More information on the problem here: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=835271 . We didn't experience this problem until we upgraded Debian.

It's not at all a pull request, but I was able to "fix" this issue for myself by trivially replacing riemann_pb2.py with the python 3 implementation (since I'm using python 3, I don't care about the python 2 implementation).

@borntyping
Copy link
Owner

I might not be reading the bug correctly, but it sounds like renaming riemann_pb2_py3 to riemann_py3_pb2 (and same with the python 2 version) might also fix the problem?

@aduston
Copy link

aduston commented Feb 28, 2017

I might not be reading the bug correctly, but it sounds like renaming riemann_pb2_py3 to riemann_py3_pb2 (and same with the python 2 version) might also fix the problem?

Reading the underlying change in the protobuf library, I believe this will work.

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

No branches or pull requests

3 participants