Thread isolation problem

Hayk Kocharyan

Новичок
Регистрация
14.06.2025
Сообщения
2
Благодарностей
0
Баллы
1
I’m experiencing a concurrency issue with my Zennoposter project. I’m currently testing the login process in parallel with 20 threads. I have a RabbitMQ database where I store IDs, usernames, and passwords. Each Zennoposter thread is supposed to check the database for a record, use those credentials to attempt a login, and then send back a callback with the corresponding IDs and the result of the attempt (successful or not).

The problem is that sometimes the IDs are getting mixed up. For instance, a thread might report a successful login for a set of credentials that shouldn’t be successful — or it might be sending back a callback with the wrong IDs. I suspect this happens because a thread may be accessing or affecting another thread’s browser instance instead of its own, causing a mix-up in the data.
 

lokiys

Moderator
Регистрация
01.02.2012
Сообщения
4 878
Благодарностей
1 195
Баллы
113
Hi and welcome.
All I can say is you have to track where this problem comes, if you use some advanced c# code then you have to take care of locking tables or lists or any copy paste, maybe. I don't know your templates logic. But threads don't share data by default.

How your 20 threads are getting data? From DB? How do you prevent threads from accessing SAME rows in DB?
If 20 threads are accessing your DB they will access SAME row it that happens at the same time.
 

Hayk Kocharyan

Новичок
Регистрация
14.06.2025
Сообщения
2
Благодарностей
0
Баллы
1
Hi, thank you for your response.


I’m making a GET request to read data from RabbitMQ, and the data I receive is not repeated. Eventually, I also read the same data from the browser and send it with a POST request. I compare the browser data with the ID I first received from the GET request.


The issue I’m encountering is that sometimes the data from one ID gets mixed up with data from a different browser session. This mainly happens when the traffic is high.
 

lokiys

Moderator
Регистрация
01.02.2012
Сообщения
4 878
Благодарностей
1 195
Баллы
113
How can you receive unique data from RabbitMQ? Does RabbitMQ have some kind of locking mechanism that doesn't allow you to access the same row simultaneously?

As you say, you compare data from DB and data from browser, so you should see there if any data is mixed up, no?

In general you have to make extensive logs in your template and save data after every step you make and then inspect those log files you made and check at what point data gets mixed up.

Threads can share data only if you use global variables, and if you use methods like copy paste (without locking) Like you copy in one thread and some other thread will do paste, then it can mix up without proper logic.
 

Кто просматривает тему: (Всего: 1, Пользователи: 0, Гости: 1)