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

Bug UnsupportedOperation: Only a Thread within a bot's ThreadGroup may eavesdrop on the game client

Discussion in 'Developer Support' started by Serene, Dec 24, 2016.

  1. Serene

    Serene ( ͡° ͜ʖ ͡°)

    Joined:
    Mar 30, 2015
    Messages:
    2,408
    Likes Received:
    508
    Happens on all of my bots; both locally in dev mode, as well as w/ other users using the bot reporting it. Has only started recently for me. I was away for a few months and prior to that it didn't happen. In dev mode, the error points to my GUI setup, specifically loading the InputStream, even though if I rerun the bot my GUI will load w/o a problem. Some other users (@awesome123man and more) are also having this problem.

    Party mentioned it had something to do with the AbstractBot class, but I can't figure out what could be causing it.

    Full exception:
    Code (Text):
    1. java.lang.UnsupportedOperationException: Only a Thread within a bot's ThreadGroup may eavesdrop on the game client.
    2.  at nul.iIiIiIiIiIiI.float(blb:158)
    3.  at com.runemate.game.api.hybrid.Environment.getBot(yqb:62)
    4.  at com.runemate.game.api.hybrid.GameEvents$GameEvent.isEnabled(lw:86)
    5.  at nul.iIIIIIiIiiIi.validate(whb:124)
    6.  at com.runemate.game.api.script.framework.LoopingBot.run(mxa:193)
    7.  at com.runemate.game.api.script.framework.AbstractBot.start(dza:163)
    8.  at nul.iiIiIIiiIIII.run(vib:99)
    9. RuneMate v2.4.4.4 - DivineFire v1.3.0 - OSRS r129 21CB29 - Windows 10 - Java8u92 x86 (Oracle Corporation)
     
  2. Party

    Party Client Developer

    Joined:
    Oct 12, 2015
    Messages:
    3,708
    Likes Received:
    1,606
    Because onStart is not always necessarily called from bot platform. Show the code where it's happening and may be able to assist.

    TL;DR - threading is a bitch.


    Sent from my iPhone using Tapatalk
     
  3. Serene

    Serene ( ͡° ͜ʖ ͡°)

    Joined:
    Mar 30, 2015
    Messages:
    2,408
    Likes Received:
    508
    I'll edit this with an update on exactly everything when I test it (can't right now bc Christmas) but off the top of my head the error points to the setup of the gui, specifically to:

    Code (Text):
    1. loader.load(stream.get());
    which points to:

    Code (Text):
    1.  
    2. Future<InputStream> stream = bot.getPlatform().invokeLater(() ->
    3.         Resources.getAsStream("UI/Practice.fxml"));
    from this in the main class:
    Code (Text):
    1. public ObjectProperty<? extends Node> botInterfaceProperty() {
    2.         if (botInterfaceProperty == null) {
    3.             botInterfaceProperty = new SimpleObjectProperty<>(configUI  = new GuiFXSetup(this));
    4.         }
    5.         return botInterfaceProperty;
    6.     }
    --- Double Post Merged, Jan 1, 2017, Original Post Date: Dec 25, 2016 ---
    @Party Just got the exception again so here's the exact error from console:

    Code (Text):
    1. java.util.concurrent.ExecutionException: java.lang.UnsupportedOperationException: Only a Thread within a bot's ThreadGroup may eavesdrop on the game client.
    2.     at java.util.concurrent.FutureTask.report(FutureTask.java:122)
    3.     at java.util.concurrent.FutureTask.get(FutureTask.java:192)
    4.     at com.deathizpro.bots.DivineRC.UI.UISetup.<init>(UISetup.java:37)
    5.     at com.deathizpro.bots.DivineRC.DivineRC.botInterfaceProperty(DivineRC.java:62)
    6.     at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    7.     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    8.     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    9.     at java.lang.Thread.run(Thread.java:745)
    10. Caused by: java.lang.UnsupportedOperationException: Only a Thread within a bot's ThreadGroup may eavesdrop on the game client.
    11.     at nul.IIIiIIiIIIIi.null(pkb:107)
    12.     at com.runemate.game.api.hybrid.Environment.getBot(hpb:24)
    13.     at com.runemate.game.api.hybrid.util.Resources.getAsStream(nab:51)
    14.     at com.deathizpro.bots.DivineRC.UI.UISetup.lambda$new$0(UISetup.java:29)
    15.     ... 4 more
    16. java.lang.UnsupportedOperationException: Only a Thread within a bot's ThreadGroup may eavesdrop on the game client.
    17.     at nul.IIIiIIiIIIIi.null(pkb:107)
    18.     at com.runemate.game.api.hybrid.Environment.getBot(hpb:24)
    19.     at nul.IIIIIIiIIiIi.run(thb:130)
    20.     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    21.     at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
    22.     at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
    23.     at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
    24.     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    25.     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    26.     at java.lang.Thread.run(Thread.java:745)
    Error points to (specifically the loader.load() line):
    Code (Text):
    1.         try {
    2.             loader.load(stream.get());
    3.         } catch (IOException | InterruptedException | ExecutionException e) {
    4.             System.err.println("Error loading GUI");
    5.             e.printStackTrace();
    6.         }
    Which is called in my interface setup (UISetup class), which is called from the main bot thread trying to create a new instance in the botInterfaceProperty() method:

    Code (Text):
    1.     public ObjectProperty<? extends Node> botInterfaceProperty() {
    2.         if (botInterfaceProperty == null) {
    3.             botInterfaceProperty = new SimpleObjectProperty<>(uiSetup = new UISetup(this));
    4.         }
    5.         return botInterfaceProperty;
    6.     }
    Also, here's a look at my InputStream:

    Code (Text):
    1. Future<InputStream> stream = bot.getPlatform().invokeLater(() ->
    2.                 Resources.getAsStream("DivineRC/UI/ReworkedUI.fxml"));

    This doesn't happen all of the time. Just some of the time, and when it does happen the UI doesn't load and the bot will crash prompting the user to send errors (so my exception log is being bombarded atm). If it doesn't happen, the UI loads fine.
     
  4. Arbiter

    Arbiter Mod Automation

    Joined:
    Jul 26, 2013
    Messages:
    2,938
    Likes Received:
    1,266
    How is this possible @Cloud @SlashnHax? It should be relatively simple to trace the calls to onStart and make sure they're being invoked from a bot thread should it not?
     
  5. mattdewd

    Joined:
    Jan 5, 2017
    Messages:
    1
    Likes Received:
    0
    Getting this same exact error as well, inconsistently it seems.
    Happens when I run RM through batch file made in RM directory but not when I run through IntelliJ.
     
  6. Glitch_

    Glitch_ bored

    Joined:
    Feb 11, 2017
    Messages:
    21
    Likes Received:
    6
    Bringing this back to life because I keep getting this error with this ui framework I've been working on.
     
  7. Serene

    Serene ( ͡° ͜ʖ ͡°)

    Joined:
    Mar 30, 2015
    Messages:
    2,408
    Likes Received:
    508
    Where does the error point to?
     
  8. Glitch_

    Glitch_ bored

    Joined:
    Feb 11, 2017
    Messages:
    21
    Likes Received:
    6
    It's whenever BIP is accessed/modified outside of the initial Bot class. So, for instance, I have an FX Controller that sets the BIP's current Node whenever x happens (ui item is clicked most likely), and if I have anything like that external, I get this exception. Even though it's all technically within the same Bot. All new classes should be appended to the same ThreadGroup that the parent Bot is running on (I would assume).
     
  9. Party

    Party Client Developer

    Joined:
    Oct 12, 2015
    Messages:
    3,708
    Likes Received:
    1,606
    All FX modifications must be done on the FX Platform, and all bot related activities must be done on the Bot Platform.
     
  10. roboter

    Joined:
    Apr 5, 2017
    Messages:
    101
    Likes Received:
    23
    this bug happens to me nearly every time when i try to test my bots ... so i created a simple testbot that only has onLoop() .... he still crashes on startup (with the same exception Serene posted).
    This may be interesting:
    runemate bug.PNG
    Why is it starting so many instances?
    The annoying part about this is, that after this happens, i can't test my bots anymore for ~20 mins because "my bot límit exceeded"
     
  11. Savior

    Savior Java Warlord

    Joined:
    Nov 17, 2014
    Messages:
    4,906
    Likes Received:
    2,748
    Dont forcefully shutdown the client.
     
    sickness0666 likes this.
  12. roboter

    Joined:
    Apr 5, 2017
    Messages:
    101
    Likes Received:
    23
    do you mean this button?
    Unbenannt.PNG
     
  13. Cloud

    Cloud Engineer

    Joined:
    Jul 28, 2013
    Messages:
    2,777
    Likes Received:
    1,124
    yes, don't use that button.
     
    sickness0666 likes this.
  14. roboter

    Joined:
    Apr 5, 2017
    Messages:
    101
    Likes Received:
    23
    Thanks, that solved my main problem, i hope you can fix the other problem too
     
  15. Serene

    Serene ( ͡° ͜ʖ ͡°)

    Joined:
    Mar 30, 2015
    Messages:
    2,408
    Likes Received:
    508
    What line is the crash pointing to? Paste that.
     
  16. roboter

    Joined:
    Apr 5, 2017
    Messages:
    101
    Likes Received:
    23
    Code (Text):
    1. java.lang.UnsupportedOperationException: Only a Thread within a bot's ThreadGroup may eavesdrop on the game client. Current Thread=Thread[pool-5-thread-1,2,[t-g]11520 - Testbot]
    2.     at nul.iiiiIIiiIIii.super(bqb:164)
    3.     at com.runemate.game.api.hybrid.Environment.getBot(anb:94)
    4.     at nul.IiIIIIiIiiiI.run(xdb:187)
    5.     at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    6.     at java.util.concurrent.FutureTask.runAndReset(Unknown Source)
    7.     at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(Unknown Source)
    8.     at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
    9.     at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    10.     at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    11.     at java.lang.Thread.run(Unknown Source)
    12. SDK mode is intended for active bot development only. As such, there is a three hour runtime limit while in SDK mode for users who are not Bot Authors. If you are an aspiring Bot Author, please continue on and best of luck! The moment you publish your first bot this limit will be removed. If you are an end user please contact your bot provider and ask them to publish the bot via the Bot Store, so it can be reviewed for safety. For more information please visit <a href="https://www.runemate.com/community/threads/restrict-sdk-runtime-for-end-users.4277/">the discussion thread</a>.
    13. [Caution: Performance Issue] Testbot is using the default loop delay of [200,400].
    14. [Caution: Continued] It is HIGHLY suggested that you change this value within onStart(String... args) to prevent lag, resource waste, and to make your bots have more unique timings.
    15. [Caution: Limited API usage] You're only using a small portion of the api, we recommend you look into some of our EventListeners such as the InventoryListener.
    16. java.lang.UnsupportedOperationException: Only a Thread within a bot's ThreadGroup may eavesdrop on the game client. Current Thread=Thread[pool-6-thread-1,5,[t-g]11520 - Testbot]
    17.     at nul.iiiiIIiiIIii.super(bqb:164)
    18.     at com.runemate.game.api.hybrid.Environment.getGameType(anb:109)
    19.     at com.runemate.game.api.hybrid.Environment.isRS3(anb:47)
    20.     at nul.iIiIiIiIIiIi.super(oeb:172)
    21.     at nul.iIiIiIiIIiIi.validate(oeb:214)
    22.     at com.runemate.game.api.script.framework.LoopingBot.run(gbb:1)
    23.     at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    24.     at java.util.concurrent.FutureTask.run(Unknown Source)
    25.     at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    26.     at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    27.     at java.lang.Thread.run(Unknown Source)
    28. java.lang.UnsupportedOperationException: Only a Thread within a bot's ThreadGroup may eavesdrop on the game client. Current Thread=Thread[Bot-Testbot,2,[t-g]11520 - Testbot]
    29.     at nul.iiiiIIiiIIii.super(bqb:164)
    30.     at com.runemate.game.api.hybrid.Environment.getBot(anb:94)
    31.     at com.runemate.game.api.hybrid.Environment.getLogger(anb:146)
    32.     at nul.IiIIIIiiIIiI.super(okb:214)
    33.     at com.runemate.game.api.script.framework.AbstractBot.start(zza:10587)
    34.     at nul.iIIiiIiiiIiI.run(ajb:13)
     

Share This Page

Loading...