1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How can I avoid Stack Overflow Exceptions on continuous bots?

Discussion in 'Visual Basic .NET' started by russellhope, Feb 25, 2016.

  1. russellhope

    russellhope Registered Member

    Joined:
    Jan 11, 2010
    Messages:
    81
    Likes Received:
    6
    Basically the title says it all.

    I keep getting Stack overflow exceptions on my bots and it always fires on a different line. I understand the error but I'm not sure how I can avoid it.

    My bot is designed to run 24/7, but chucks this error after only a few hours, it goes a little like so.

    Sign up -> Scrape -> Post -> Sign out -> Sign up & so on...

    Any help appreciated.
     
  2. HoNeYBiRD

    HoNeYBiRD Jr. VIP Jr. VIP

    Joined:
    May 1, 2009
    Messages:
    7,513
    Likes Received:
    8,438
    Gender:
    Male
    Occupation:
    Geographer, Tourism Manager
    Location:
    Ghosted
    I'm far from a coder, but if you get the errors after a few hours of running every time, it would seem logical to me, that you leave short delays in whatever you're doing, and it's just an antibot prevention of stack overflow, which you can circumvent either by using bigger delays and/or using more accounts to perform less actions.

    If it's not the case, you can try less elegant solutions, like skipping the error and try to continue with the next account, if that doesn't help either and the whole bots stops functioning, then you can use a scheduler to stop/restart the bot in every few hours or right in the moment when the first exception happens.

    These are just my DIY ideas, maybe someone who has better knowledge, will chime in and help you out :)
     
  3. russellhope

    russellhope Registered Member

    Joined:
    Jan 11, 2010
    Messages:
    81
    Likes Received:
    6
    I'm not trying to bot the website stackoverflow, Stack Overflow is the error I get. If that's what you mean?
     
  4. HoNeYBiRD

    HoNeYBiRD Jr. VIP Jr. VIP

    Joined:
    May 1, 2009
    Messages:
    7,513
    Likes Received:
    8,438
    Gender:
    Male
    Occupation:
    Geographer, Tourism Manager
    Location:
    Ghosted
    lol, then i guess you can ignore my post and wait for someone who can actually help
     
  5. sockpuppet

    sockpuppet Junior Member

    Joined:
    Nov 7, 2011
    Messages:
    155
    Likes Received:
    145
    you have to use a loop, something like this
    Do While True
    Sign up -> Scrape -> Post -> Sign out
    Loop
     
  6. Intruder

    Intruder Regular Member

    Joined:
    Jun 3, 2012
    Messages:
    340
    Likes Received:
    206
    which language are you using?
    BTW are you doing a recursive call? That might be a problem of stackoverflow...
     
  7. Dev Warrior

    Dev Warrior Jr. VIP Jr. VIP Premium Member

    Joined:
    Oct 13, 2015
    Messages:
    276
    Likes Received:
    30
    Home Page:
    stackoverflow error relates to assigning memory to maximum allocated stack in memory!!
    Are you using any recursive function to handle signup --> post functionality? If yes, you must make changes to your code accordingly so that recursion of any function should never be endless.
     
    Last edited: Apr 12, 2016
  8. Netro

    Netro Junior Member

    Joined:
    Jun 12, 2015
    Messages:
    107
    Likes Received:
    27
    Occupation:
    Baka Dev.
    Before taking an action use try method.

    Try
    'thing to do
    Catch
    End Trty
    'next thing to do
     
  9. immaletyoufinish

    immaletyoufinish Regular Member

    Joined:
    Mar 3, 2016
    Messages:
    219
    Likes Received:
    113
    What's the bot coded in? I know for something like phantomJS certain navigation scenarios require using recursion. If you let it run infinitely you will keep putting things on the stack which will eventually become full when there is no memory left to allocate to the stack and that's when a stack overflow exception is thrown. If that's the case you need a different programming model.

    Give us more info on what you're writing the bot in.