Jump to content
UBot Underground

MUST READ: Threading Doesn't Work As Expected (tested in v4)


Recommended Posts

Hi Lilly

 

that won't work either because of the wait the thread count will only max at about 10-11 threads

 

try it yourself set threads to 50 and will only reach 10-11

 

 

 

pftg4

Link to post
Share on other sites
  • Replies 56
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

I was working on a project where threads started to disappear when bot processed a large number of items. The bot was running 50 threads and when it processed a few thousand items only a few threads o

Thanks for reporting your findings to the community. There is definitely a problem with the threads remaining open because of the decrement command not reducing the number of threads running. I have n

Nice to hear that I'm not the only one experiencing this. I never noticed someone mentioning this problems and it somehow worked for me till today, that's why I wasn't sure if this really is a problem

Hi Lilly

 

that won't work either because of the wait the thread count will only max at about 10-11 threads

 

try it yourself set threads to 50 and will only reach 10-11

 

 

 

pftg4

 

 The script above is a modified version of what the OP submitted to support about threads not closing at the end of the run. We modified it to have the script be more consistent with the way the threads are supposed to work.

 

Removing the 0.2 second wait commands in the thread will open all 50 threads, and after they are closed, but UI still states that one thread is left open.

 

There might be a UI issue in terms of how the threads are being counted as active and how variables are handled in the script, but the purpose of the amended script above is simply to show that threads are indeed closing and threads are working the way they are supposed to.

 

If anyone else wants to go over a script for this issue with us, we'd be happy to take a look at support.ubotstudio.com.

 

Please keep in mind that threading is a complicated process, and it requires careful investigation to figure out the source of any problems that might arise from working with it. Glancing at a video will not help us determine what is going on, but a sample script and lots relevant information will always be very helpful. 

Link to post
Share on other sites

hi lilly the issue isn't with threads closing or threads at all the problem is that increments and decrements are getting missed. This seems to be because decrements are getting missed when several threads are decrementing at the same time.

Link to post
Share on other sites

hi lilly the issue isn't with threads closing or threads at all the problem is that increments and decrements are getting missed. This seems to be because decrements are getting missed when several threads are decrementing at the same time.

 

 

hmm...I did not notice any issues with incrementing or decrementing  after the wait commands were added, but we can certainly take another look when possible.

 

I'll let the thread get back on topic. If anyone has any questions about threading, we'll be at support walk through your issues with you.

Link to post
Share on other sites

hmm...I did not notice any issues with incrementing or decrementing  after the wait commands were added, but we can certainly take another look when possible.

 

I'll let the thread get back on topic. If anyone has any questions about threading, we'll be at support walk through your issues with you.

thanks lilly your delay thou would stop the issue because it would never allow enough threads to run. use ubotdevs original example and you will find the "#THREADS Active" never returns to zero because it misses decrements. to make it really show up change change

 

drop down("Threads", "10,20,30,40,50", #INPUT Threads) to drop down("Threads", "10,20,30,40,50,100,150", #INPUT Threads)

 

and set at 150

Link to post
Share on other sites

This one works for me
with 50 Threads perfect
with 100 Threads allmost perfect
with 200 Threads not

here is the code based on the free plugin  which u can download here
http://ul.to/mmba1doj

and here the screencapturevideo for all thoese who dont belive.
https://www.youtube.com/watch?v=v7_F26crgoQ

ui drop down("COUNT""100,1000,10000,5000"#Input Count)
ui drop down("Threads""10,20,30,40,50,100,200"#INPUT Threads)
ui stat monitor("Threads (Active/Total):""<b>{#THREADS Active}/{#THREADS Max}</b>")
ui stat monitor("COUNT:"#COUNT)
set(#COUNT#Input Count"Global")
set(#THREADS Max#INPUT Threads"Global")
set(#THREADS Active, 0, "Global")
set(#listcounter, 0, "Global")
clear list(%mylist)
loop while($comparison(#COUNT">", 0)) {
    if($comparison(#THREADS Active"<"#THREADS Max)) {
        then {
            plugin command("Open.Framework.dll""Thread safe container") {
                increment(#THREADS Active)
            }
            THREAD START()
            decrement(#COUNT)
        }
        else {
            plugin command("Open.Framework.dll""Free Ubot Memory")
            wait(0.2)
        }
    }
}
set(#WAIT Count, 0, "Global")
loop while($both($comparison(#THREADS Active">", 0), $comparison(#WAIT Count"<", 10))) {
    increment(#WAIT Count)
    wait(2)
}
if($comparison(#THREADS Active">", 0)) {
    then {
        alert("Some threads were not closed/decremented properly.")
    }
    else {
        alert("All threads were closed")
    }
}
define THREAD START {
    thread {
        wait(0.5)
        plugin command("Open.Framework.dll""Thread safe container") {
            decrement(#THREADS Active)
            increment(#listcounter)
            add item to list(%mylist#listcounter"Delete""Global")
        }
    }
}


 

  • Like 1
Link to post
Share on other sites
  • 10 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...