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

it just crashes, randomly #432

Open
reloadlife opened this issue Oct 19, 2024 · 14 comments
Open

it just crashes, randomly #432

reloadlife opened this issue Oct 19, 2024 · 14 comments
Labels
bug Something isn't working

Comments

@reloadlife
Copy link
Contributor

Describe The Problem
sometimes, randomly the panel crashes and i have to do a manual restart of it (./wgd.sh restart)

Expected Error / Traceback

[2024-10-18 15:32:02,053] ERROR in app: Exception on /api/getWireguardConfigurationInfo [GET]
Traceback (most recent call last):
  File "/opt/WGDashboard/src/venv/lib/python3.10/site-packages/flask/app.py", line 1473, in wsgi_app
    response = self.full_dispatch_request()
  File "/opt/WGDashboard/src/venv/lib/python3.10/site-packages/flask/app.py", line 882, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/opt/WGDashboard/src/venv/lib/python3.10/site-packages/flask_cors/extension.py", line 194, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
  File "/opt/WGDashboard/src/venv/lib/python3.10/site-packages/flask/app.py", line 880, in full_dispatch_request
    rv = self.dispatch_request()
  File "/opt/WGDashboard/src/venv/lib/python3.10/site-packages/flask/app.py", line 865, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # type: ignore[no-any-return]
  File "/opt/WGDashboard/src/dashboard.py", line 1917, in API_getConfigurationInfo
    "configurationPeers": WireguardConfigurations[configurationName].getPeersList(),
  File "/opt/WGDashboard/src/dashboard.py", line 909, in getPeersList
    self.__getPeers()
  File "/opt/WGDashboard/src/dashboard.py", line 678, in __getPeers
    self.Peers.append(Peer(i, self))
  File "/opt/WGDashboard/src/dashboard.py", line 963, in __init__
    self.getShareLink()
  File "/opt/WGDashboard/src/dashboard.py", line 1071, in getShareLink
    self.ShareLink = AllPeerShareLinks.getLink(self.configuration.Name, self.id)
  File "/opt/WGDashboard/src/dashboard.py", line 411, in getLink
    self.__getSharedLinks()
  File "/opt/WGDashboard/src/dashboard.py", line 406, in __getSharedLinks
    allLinks = sqlSelect("SELECT * FROM PeerShareLinks WHERE ExpireDate IS NULL OR ExpireDate > datetime('now', 'localtime')").fetchall()
  File "/opt/WGDashboard/src/dashboard.py", line 1425, in sqlSelect
    with sqldb:
sqlite3.DatabaseError: no more rows available

To Reproduce
Please provide how you run the dashboard

OS Information:

  • OS: Ubuntu 20.04.6 LTS
  • Python Version: Python 3.8.10

Sample of your .conf file

[Interface]
Address = 172.16.0.1/18
Table = foo
SaveConfig = true
ListenPort = 51810
PrivateKey = [REDACTED]

[Peer]
PublicKey = [REDACTED]
AllowedIPs = 172.16.0.2/32
Endpoint = [REDACTED]

[Peer]
PublicKey = [REDACTED]
PresharedKey = [REDACTED]
AllowedIPs = 172.16.0.3/32
Endpoint = [REDACTED]

...
about 30-40 more peers ...
...

[Peer]
PublicKey = [REDACTED]
PresharedKey = [REDACTED]
AllowedIPs = 172.16.0.40/32
Endpoint = [REDACTED]

[Peer]
PublicKey = [REDACTED]
AllowedIPs = 172.16.0.41/32
@reloadlife reloadlife added the bug Something isn't working label Oct 19, 2024
@donaldzou
Copy link
Owner

Hi @reloadlife , after digging into this issue.. I couldn't find anything related to this error message, just wondering: does your memory or hard disk of your Ubuntu reached its limit?

I'll do more research and try to solve this issue :)

@reloadlife
Copy link
Contributor Author

I was wondering the same thing, I've checked and I have plenty of storage and ram, so that can't be the case ...

@donaldzou
Copy link
Owner

Yeah.. Just posted a post on the SQLite forum and hope someone would know what's going on. It got me thinking: will it caused by Python 3.10?

I'll try it on a VM and see if I can recreate this issue

@reloadlife
Copy link
Contributor Author

Can we possibly have version that uses SQL or PostgreSQL, if it is for sure caused by SQLite

@donaldzou
Copy link
Owner

donaldzou commented Oct 19, 2024 via email

@donaldzou
Copy link
Owner

donaldzou commented Oct 19, 2024 via email

@reloadlife
Copy link
Contributor Author

yeah, i've already done it, and it still remains,
i could contribute to fix the SQLStatements and convert them to support MySQL or PSQL.

using MySQL or PSQL is more stable overall.

@reloadlife
Copy link
Contributor Author

for now, i'm going to add a try / catch to prevent the panel from crashing, please merge :)

reloadlife added a commit to reloadlife/WGDashboard that referenced this issue Oct 19, 2024
donaldzou added a commit that referenced this issue Oct 21, 2024
Added a try/catch statement to prevent panel from crashing #432
@reloadlife
Copy link
Contributor Author

even after the new patch, some times, it crashes
and seems like it's whenever a new share link is created / expires, the crash happens.

-10-23 20:22:28,647] ERROR in app: Exception on /api/getWireguardConfigurationInfo [GET]
Traceback (most recent call last):
  File "/opt/WGDashboard/src/venv/lib/python3.10/site-packages/flask/app.py", line 1473, in wsgi_app
    response = self.full_dispatch_request()
  File "/opt/WGDashboard/src/venv/lib/python3.10/site-packages/flask/app.py", line 882, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/opt/WGDashboard/src/venv/lib/python3.10/site-packages/flask_cors/extension.py", line 194, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
  File "/opt/WGDashboard/src/venv/lib/python3.10/site-packages/flask/app.py", line 880, in full_dispatch_request
    rv = self.dispatch_request()
  File "/opt/WGDashboard/src/venv/lib/python3.10/site-packages/flask/app.py", line 865, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # type: ignore[no-any-return]
  File "/opt/WGDashboard/src/dashboard.py", line 1922, in API_getConfigurationInfo
    "configurationPeers": WireguardConfigurations[configurationName].getPeersList(),
  File "/opt/WGDashboard/src/dashboard.py", line 909, in getPeersList
    self.__getPeers()
  File "/opt/WGDashboard/src/dashboard.py", line 678, in __getPeers
    self.Peers.append(Peer(i, self))
  File "/opt/WGDashboard/src/dashboard.py", line 963, in __init__
    self.getShareLink()
  File "/opt/WGDashboard/src/dashboard.py", line 1071, in getShareLink
    self.ShareLink = AllPeerShareLinks.getLink(self.configuration.Name, self.id)
  File "/opt/WGDashboard/src/dashboard.py", line 411, in getLink
    self.__getSharedLinks()
  File "/opt/WGDashboard/src/dashboard.py", line 406, in __getSharedLinks
    allLinks = sqlSelect("SELECT * FROM PeerShareLinks WHERE ExpireDate IS NULL OR ExpireDate > datetime('now', 'localtime')").fetchall()
  File "/opt/WGDashboard/src/dashboard.py", line 1425, in sqlSelect
    with sqldb:
sqlite3.DatabaseError: no more rows available

@donaldzou
Copy link
Owner

Just realized you're using Python 3.8.10 not Python 3.10? Maybe is because of this?

@reloadlife
Copy link
Contributor Author

I am using 3.10 not 3.8, i thought i was using 3.8 when openning this issue, my bad on that part.

(i have 3.8 installed on the server, but the venv is using 3.10)

@donaldzou
Copy link
Owner

Are you running on a VM or a physical machine? If is a VM, maybe deploy a new Ubuntu and see if the issue still persist? I can't find anything about this issue lol..

@reloadlife
Copy link
Contributor Author

it is on a VM, and i did try it on a new machine, it still happens ...
i couldn't find anything about it either ...

@donaldzou
Copy link
Owner

How many cores, memory and storage did you assigned to your VM?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants