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

Not re-enabling the user after Periodic Usage Reset #1131

Open
Ashaxer opened this issue Jul 17, 2024 · 2 comments
Open

Not re-enabling the user after Periodic Usage Reset #1131

Ashaxer opened this issue Jul 17, 2024 · 2 comments
Labels
Bug Something isn't working

Comments

@Ashaxer
Copy link

Ashaxer commented Jul 17, 2024

Describe the bug
When the user reaches its periodic usage limit, marzban will disable user access to the servers.
After Periodic Usage Reset happens, the user's periodic usage will reset to 0 but SOMETIMES marzban does not enable the user access.

To Reproduce
I didn't find any pattern in the bug happening.

Expected behavior
If a user has reached its usage limit, when he tests for connectivity of the servers, he will face an EOF error.
In this scenario, user usage has been reset but still gets the EOF error instantly.
The only fix for this bug is to update the user status by opening the user settings in the Admin panel and clicking on "Edit User"
Edit:
Restarting Core also resolves the issue.

Machine details
OS: [e.g. ubuntu 24]
Marzban version: [5.2] (also happened in 4.9)

@Ashaxer Ashaxer added the Bug Something isn't working label Jul 17, 2024
@erfjab
Copy link
Contributor

erfjab commented Jul 30, 2024

Describe the bug
When the user reaches its periodic usage limit, marzban will disable user access to the servers.
After Periodic Usage Reset happens, the user's periodic usage will reset to 0 but SOMETIMES marzban does not enable the user access.

To Reproduce
I didn't find any pattern in the bug happening.

Expected behavior
If a user has reached its usage limit, when he tests for connectivity of the servers, he will face an EOF error.
In this scenario, user usage has been reset but still gets the EOF error instantly.
The only fix for this bug is to update the user status by opening the user settings in the Admin panel and clicking on "Edit User"

Machine details
OS: [e.g. ubuntu 24]
Marzban version: [5.2] (also happened in 4.9)

Added to Tasks ✅

@Ashaxer
Copy link
Author

Ashaxer commented Jan 5, 2025

Hi again, since this issue still happening in version 0.7.0, I'm using this script to restart the core using marzban-api periodically by saving it and using cronjobs:

#!/bin/bash
echo "Requesting access token..."
# Replace address and port if necessary
# Replace ADMIN_USER and PASSWORD with actual values
token_response=$(curl -sk 'https://127.0.0.1:443/api/admin/token' \
  -H 'content-type: application/x-www-form-urlencoded' \
  --data-raw 'grant_type=password&username=ADMIN_USER&password=PASSWORD')

access_token=$(echo "$token_response" | jq -r '.access_token')

if [ -z "$access_token" ] || [ "$access_token" == "null" ]; then
  echo "Failed to retrieve access token. Response:"
  echo "$token_response"
  exit 1
fi

echo "Access token obtained: $access_token"

echo "Restarting Core..."
# Replace address and port if necessary 
restart_response=$(curl -sk 'https://127.0.0.1:443/api/core/restart' \
  -X 'POST' \
  -H "authorization: Bearer $access_token" \
  -H 'content-type: application/json')
echo "Restart response:"
echo "$restart_response"

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