Skip to content

IndexError: pop from empty list #227

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

Closed
gusibi opened this issue Jun 11, 2018 · 5 comments
Closed

IndexError: pop from empty list #227

gusibi opened this issue Jun 11, 2018 · 5 comments

Comments

@gusibi
Copy link
Contributor

gusibi commented Jun 11, 2018

elasticapm/traces.py

def end_span(self, skip_frames):
        span = self.span_stack.pop()

span_stack may be empty

IndexError: pop from empty list

gusibi added a commit to gusibi/apm-agent-python that referenced this issue Jun 11, 2018
@beniwohli
Copy link
Contributor

Thanks @gusibi! Usually, when this happens, it is caused by another bug. Do you have the full stack trace of this error?

@gusibi
Copy link
Contributor Author

gusibi commented Jun 11, 2018

2018-06-11 18 51 13
2018-06-11 18 51 29
2018-06-11 18 51 41

@gusibi
Copy link
Contributor Author

gusibi commented Jun 11, 2018

redis server is pika
https://github.com/Qihoo360/pika

beniwohli added a commit to beniwohli/apm-agent-python that referenced this issue Jun 11, 2018
Usually, this shouldn't happen and is an indication of a bug. But we
should still ensure that we don't crash and instead log a message.

fixes elastic#227
beniwohli added a commit to beniwohli/apm-agent-python that referenced this issue Jun 11, 2018
Usually, this shouldn't happen and is an indication of a bug. But we
should still ensure that we don't crash and instead log a message.

fixes elastic#227

Co-authored-by: goodspeed <[email protected]>
@beniwohli
Copy link
Contributor

Thanks for the update. It's hard to say what exactly can cause this. The only place where we call begin_span is in capture_span.__enter__, and the only place where we call end_span is in capture_span.__exit__. According to the context manager protocol, if we __enter__, we will also always __exit__.

So the only explanation that I have is that the transaction object in __enter__ is different than the one in __exit__.

@gusibi do you per chance use an asynchronous framework (asyncio, twisted, ...)? We currently don't support asynchronous execution (see #16), and I could imagine that it could cause an error like this.

@gusibi
Copy link
Contributor Author

gusibi commented Jun 12, 2018

@beniwohli Thanks
I use the flask, not used asynchronous framework.

This error all in the process of using redis.
And not every time this error occurs.

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

Successfully merging a pull request may close this issue.

2 participants