alexmojaki / birdseye

Graphical Python debugger which lets you easily view the values of all evaluated expressions
https://birdseye.readthedocs.io
MIT License
1.65k stars 72 forks source link

IndexError: list index out of range #76

Closed ghost closed 5 years ago

ghost commented 5 years ago

After running python -m birdseye.clear_db and executing the program again, I'm now getting this exception when I click on a function from the front page.

Traceback (most recent call last):
  File "/home/user/.envs/dotfiles-_bp8OBTv/lib/python3.6/site-packages/flask/app.py", line 1836, in __call__
    return self.wsgi_app(environ, start_response)
  File "/home/user/.envs/dotfiles-_bp8OBTv/lib/python3.6/site-packages/flask/app.py", line 1820, in wsgi_app
    response = self.make_response(self.handle_exception(e))
  File "/home/user/.envs/dotfiles-_bp8OBTv/lib/python3.6/site-packages/flask/app.py", line 1403, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/home/user/.envs/dotfiles-_bp8OBTv/lib/python3.6/site-packages/flask/_compat.py", line 33, in reraise
    raise value
  File "/home/user/.envs/dotfiles-_bp8OBTv/lib/python3.6/site-packages/flask/app.py", line 1817, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/user/.envs/dotfiles-_bp8OBTv/lib/python3.6/site-packages/flask/app.py", line 1477, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/user/.envs/dotfiles-_bp8OBTv/lib/python3.6/site-packages/flask/app.py", line 1381, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/home/user/.envs/dotfiles-_bp8OBTv/lib/python3.6/site-packages/flask/_compat.py", line 33, in reraise
    raise value
  File "/home/user/.envs/dotfiles-_bp8OBTv/lib/python3.6/site-packages/flask/app.py", line 1475, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/user/.envs/dotfiles-_bp8OBTv/lib/python3.6/site-packages/flask/app.py", line 1461, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/user/.envs/dotfiles-_bp8OBTv/lib/python3.6/site-packages/littleutils/__init__.py", line 227, in wrapper
    return func(*args, **kwargs)
  File "/home/user/.envs/dotfiles-_bp8OBTv/lib/python3.6/site-packages/birdseye/db.py", line 229, in wrapper
    return func(session, *args, **kwargs)
  File "/home/user/.envs/dotfiles-_bp8OBTv/lib/python3.6/site-packages/birdseye/server.py", line 132, in func_view
    func = session.query(Function).filter_by(file=path, name=func_name)[0]
  File "/home/user/.envs/dotfiles-_bp8OBTv/lib/python3.6/site-packages/sqlalchemy/orm/query.py", line 2692, in __getitem__
    return list(self[item:item + 1])[0]
IndexError: list index out of range

birdseye 0.8.1 python 3.6.5 ubuntu 18.04

alexmojaki commented 5 years ago

Restart the server and refresh the home page in the browser.

ghost commented 5 years ago

I did, no change. This is with import birdseye.trace_module_deep

alexmojaki commented 5 years ago
  1. Stop all running python programs, including the birdseye server. Verify none are running with ps aux | grep python.
  2. Close all birdseye browser tabs.
  3. Verify that visiting http://localhost:7777 now results in an error.
  4. Run python -m birdseye.clear_db.
  5. Delete ~/.birdseye.db for good measure.
  6. Start birdseye server.
  7. Verify that visiting http://localhost:7777 now results in a page with no calls or functions.
  8. Run the program.
  9. Refresh the home page.

If you still get the error, please share:

  1. A screenshot of your home page.
  2. The exact thing that you're clicking on.
  3. Code that reproduces the error.

Right now I don't have enough information to reproduce this.

ghost commented 5 years ago

I reproduced on another computer. The error occurred if I click on a link, go back to homepage, 4 times.

Homepage looks like:

cata.py s fm cat cf Execution of module

Code:

import birdseye.trace_module_deep

def fm(f, data):
    if isinstance(data, list):
        return [f(x) for x in data]
    return data

def cat(f, data):
    def cf(x):
        return cat(f, x)
    return f(fm(cf, data))

def s(data):
    if isinstance(data, list):
        return sum(data)
    return data

values = [[[1, 2], [20]], [300]]
result = cat(s, values)
print(result)
alexmojaki commented 5 years ago

Thanks for your efforts! I appreciate you taking the time to figure this out with me.

Unfortunately I still can't reproduce it with any amount of clicking, using that exact code and my homepage looking just like that.

Please share the exact actions. Which link are you clicking? Does going back to the homepage mean clicking the browser back button?

Once you see the error, what does it take to make it go away?

Is it always that same traceback?

Is Flask showing any other logs? Can you share them?

ghost commented 5 years ago

I've reproduced on a server I can provide access to if you'd like to investigate further. Perhaps the simplest way is if you'd like to share an ssh public key I can authorize it and post the connection info.

alexmojaki commented 5 years ago

Awesome! Here you go:

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC3CDoZExgKf+6qmdxmdnsXqv/4aVa9BIqsKwDyCYA83P8lcZiGZmCae4kKphS0ecbtaEkZtwkqHy9SCgzFTCrY1XOfPWFy9QmFCA0/tvUNUZcDV7Lw+4UuG/AxQBnKFd4TBXUzm+xYxBAXj3fe5PJ5d0sWtKRPHxFyGGokKlyiUY+IcwV8N+tKLQ43Krx0ZGXjQ3V6NdG8XaPCz70VbGo5o/0SrapSXb/LbBb+/G+ZUaYlIsPw+XNzVGJq2ONjj8S/ruMySJ3WjTIZwm/cpP4BeiLHiEIi1KDhFn/xNFmmbFQBX0VvmSY+UQ/wTgL6MhhkyP4DOP66KQj1PN7T4wM0E3FXJ6bS7y/wt4G9OeAL/wq4l6wAExymVJKUQH8bkN3uNQ+fYhfiNwqONZzF9YD70+n3oXRrbhe/PSUr2+CRRXXUoZStKiMknV6dd8pfIE7YjNY/18ZTF04vwnW0eqTfFT5hGyJKLdKQ/aFCnQ6cNn9tAf4h7VAa5gRD+pnpujoHhPAXDvpY65dQmIHFNIFs5jxOCJrGbNRFZpFv0/TexeNTGCtE6op+vKs3YZi6PmVDuWYtwKwYnCzkZwA28G2nZo/o8jH/OrlENLjJSXYevqVuxxA1XkMYPStZtGO3701HjpylMGYNohKJsziuyh4mHKcfCTnpRzUjBjVu6292Kw== alex.mojaki@gmail.com
ghost commented 5 years ago

Birdseye is currently executing in a virtualenv. Please try ssh user@46.101.144.229

alexmojaki commented 5 years ago

This is how all bug reports should be done!

I've found the problem, it's about absolute paths and tracing modules. Will push out a fix soon.

Thanks again.

alexmojaki commented 5 years ago

OK, upgrade and give it a go.

ghost commented 5 years ago

Works great, thanks!