Closed Somebobys closed 2 months ago
id is a uuid and it's nearly impossible to generate 2 similar uuid. i don't think this situation be possible, how many users do you have ?
id is a uuid and it's nearly impossible to generate 2 similar uuid. i don't think this situation be possible, how many users do you have ?
I generate the UUID myself and insert it when creating a user, I also generate the username myself, due to the fact that sometimes two users are created, their names may be different (because I generate them randomly), but the UUID(id) remains the same and the same because I need it so much in my system
The problem itself is that sometimes a duplicate entry is generated in proxies with the same UUID, can this be fixed somehow?
I think that at the level of the panel itself it is necessary to prohibit the creation of users, where the ID will be equal to what is already in the database, right?
I have 90 thousand users
I generate the UUID myself and insert it when creating a user.
let marzban do the job, don't generate it yourself
I also generate the username myself, due to the fact that sometimes two users are created, their names may be different (because I generate them randomly
you should generate usernames yourself because marzban don't do that
i write a code to check how rare it is to get duplicate uuid
package main
import (
"fmt"
"github.com/google/uuid"
)
func generate(i int) bool {
uuidMap := make(map[uuid.UUID]bool)
for range i {
id := uuid.New()
uuidMap[id] = true
}
if len(uuidMap) == i {
return true
}
return false
}
func main() {
for i := 0; i < 10; i++ {
result := generate(10000000)
fmt.Println(result)
}
}
i tried this bunch of times, even i try to generate 100 million uuid together but all the time i got completely unique uuid map your case is very rare and i think something is wrong with your uuid generating function, let marzban generate id's and check this gonna happen again or not
Unfortunately, the option where UUID generation is automatic on the Marzban side does not quite suit me. The thing is that the UUID that I insert when creating a user is the UUID of the device, so it is usually always static for each device.
In general, I have an idea of how to change my backend logic so that such a repetition does not happen.
But, I would like to clarify with you, wouldn't it be a logically correct decision to validate the ID(uuid) parameter on the Marzban side? After all, we do not have such cases when ID(uuid) should be the same for more than 1 user, otherwise there will simply be incorrect work. If I'm wrong, please correct me.
Unfortunately, the option where UUID generation is automatic on the Marzban side does not quite suit me. The thing is that the UUID that I insert when creating a user is the UUID of the device, so it is usually always static for each device.
In general, I have an idea of how to change my backend logic so that such a repetition does not happen.
But, I would like to clarify with you, wouldn't it be a logically correct decision to validate the ID(uuid) parameter on the Marzban side? After all, we do not have such cases when ID(uuid) should be the same for more than 1 user, otherwise there will simply be incorrect work. If I'm wrong, please correct me.
people made uuid to avoid duplicate checks, this is nature of uuid to be random so no there is no need for external check uuid is duplicate or not , just think about affect can make in a system like your system with 90k users, everything gonna become slower also nature of uuid cover 99.9999999999 percent of possibilities, i suggest you change your back-end
Yes, you are right, thank you.
Describe the bug Sometimes when I create a user through the Marzban API, it happens that it is created twice (under different names) but with the same Proxies ID, which causes Marzban to rely on the second created configuration, and not on the first, as a result of which when there are many users, they are faced with a problem in limiting traffic, because I control only the first created config, and Marzban relies on the second.
To Reproduce Steps to reproduce the behavior:
I can’t describe this in detail because I don’t know how it happens, but it happens through user creation through the Marzban API.
When a double occurs, I need to go to the Marzban database in the proxies table, and look for the double there by ID, for example like this: SELECT * FROM proxies WHERE settings LIKE '%1111-1111-1111-1111%';
Delete it, remember the line ID, go to users, search there by ID and delete the entry, then you need to go to the marzban panel and recreate the first configuration for it to work.
Expected behavior So that when creating a user via the Marzban API, there are no duplicate entries
Screenshots If applicable, add screenshots to help explain your problem.
Machine details (please complete the following information):
Additional context I have version 0.6.0 of the panel, as I saw from the commits, this problem should have been fixed, but it is not.
I am ready to provide all the necessary information that is requested from me to correct this problem.
It makes life very difficult when there are a lot of users and there is a constant stream of their creation.