Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

Sign up now!

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

( ͡° ͜ʖ ͡°)
Joined
Mar 30, 2015
Messages
2,416
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:
java.lang.UnsupportedOperationException: Only a Thread within a bot's ThreadGroup may eavesdrop on the game client.
 at nul.iIiIiIiIiIiI.float(blb:158)
 at com.runemate.game.api.hybrid.Environment.getBot(yqb:62)
 at com.runemate.game.api.hybrid.GameEvents$GameEvent.isEnabled(lw:86)
 at nul.iIIIIIiIiiIi.validate(whb:124)
 at com.runemate.game.api.script.framework.LoopingBot.run(mxa:193)
 at com.runemate.game.api.script.framework.AbstractBot.start(dza:163)
 at nul.iiIiIIiiIIII.run(vib:99)
RuneMate v2.4.4.4 - DivineFire v1.3.0 - OSRS r129 21CB29 - Windows 10 - Java8u92 x86 (Oracle Corporation)
 
Client Developer
Joined
Oct 12, 2015
Messages
3,781
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
 
( ͡° ͜ʖ ͡°)
Joined
Mar 30, 2015
Messages
2,416
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:
loader.load(stream.get());

which points to:

Code:
Future<InputStream> stream = bot.getPlatform().invokeLater(() ->
        Resources.getAsStream("UI/Practice.fxml"));

from this in the main class:
Code:
public ObjectProperty<? extends Node> botInterfaceProperty() {
        if (botInterfaceProperty == null) {
            botInterfaceProperty = new SimpleObjectProperty<>(configUI  = new GuiFXSetup(this));
        }
        return botInterfaceProperty;
    }
 
@Party Just got the exception again so here's the exact error from console:

Code:
java.util.concurrent.ExecutionException: java.lang.UnsupportedOperationException: Only a Thread within a bot's ThreadGroup may eavesdrop on the game client.
    at java.util.concurrent.FutureTask.report(FutureTask.java:122)
    at java.util.concurrent.FutureTask.get(FutureTask.java:192)
    at com.deathizpro.bots.DivineRC.UI.UISetup.<init>(UISetup.java:37)
    at com.deathizpro.bots.DivineRC.DivineRC.botInterfaceProperty(DivineRC.java:62)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.UnsupportedOperationException: Only a Thread within a bot's ThreadGroup may eavesdrop on the game client.
    at nul.IIIiIIiIIIIi.null(pkb:107)
    at com.runemate.game.api.hybrid.Environment.getBot(hpb:24)
    at com.runemate.game.api.hybrid.util.Resources.getAsStream(nab:51)
    at com.deathizpro.bots.DivineRC.UI.UISetup.lambda$new$0(UISetup.java:29)
    ... 4 more
java.lang.UnsupportedOperationException: Only a Thread within a bot's ThreadGroup may eavesdrop on the game client.
    at nul.IIIiIIiIIIIi.null(pkb:107)
    at com.runemate.game.api.hybrid.Environment.getBot(hpb:24)
    at nul.IIIIIIiIIiIi.run(thb:130)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

Error points to (specifically the loader.load() line):
Code:
        try {
            loader.load(stream.get());
        } catch (IOException | InterruptedException | ExecutionException e) {
            System.err.println("Error loading GUI");
            e.printStackTrace();
        }

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:
    public ObjectProperty<? extends Node> botInterfaceProperty() {
        if (botInterfaceProperty == null) {
            botInterfaceProperty = new SimpleObjectProperty<>(uiSetup = new UISetup(this));
        }
        return botInterfaceProperty;
    }

Also, here's a look at my InputStream:

Code:
Future<InputStream> stream = bot.getPlatform().invokeLater(() ->
                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.
 
Mod Automation
Joined
Jul 26, 2013
Messages
3,053
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?
 
Joined
Jan 5, 2017
Messages
1
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.
 
bored
Joined
Feb 11, 2017
Messages
21
Bringing this back to life because I keep getting this error with this ui framework I've been working on.
 
bored
Joined
Feb 11, 2017
Messages
21
Where does the error point to?

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).
 
Client Developer
Joined
Oct 12, 2015
Messages
3,781
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).

All FX modifications must be done on the FX Platform, and all bot related activities must be done on the Bot Platform.
 
Joined
Apr 5, 2017
Messages
101
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"
 
Java Warlord
Joined
Nov 17, 2014
Messages
4,906
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:
View attachment 2147
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"
Dont forcefully shutdown the client.
 
Joined
Apr 5, 2017
Messages
101
Code:
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]
    at nul.iiiiIIiiIIii.super(bqb:164)
    at com.runemate.game.api.hybrid.Environment.getBot(anb:94)
    at nul.IiIIIIiIiiiI.run(xdb:187)
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    at java.util.concurrent.FutureTask.runAndReset(Unknown Source)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(Unknown Source)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
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>.
[Caution: Performance Issue] Testbot is using the default loop delay of [200,400].
[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.
[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.
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]
    at nul.iiiiIIiiIIii.super(bqb:164)
    at com.runemate.game.api.hybrid.Environment.getGameType(anb:109)
    at com.runemate.game.api.hybrid.Environment.isRS3(anb:47)
    at nul.iIiIiIiIIiIi.super(oeb:172)
    at nul.iIiIiIiIIiIi.validate(oeb:214)
    at com.runemate.game.api.script.framework.LoopingBot.run(gbb:1)
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
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]
    at nul.iiiiIIiiIIii.super(bqb:164)
    at com.runemate.game.api.hybrid.Environment.getBot(anb:94)
    at com.runemate.game.api.hybrid.Environment.getLogger(anb:146)
    at nul.IiIIIIiiIIiI.super(okb:214)
    at com.runemate.game.api.script.framework.AbstractBot.start(zza:10587)
    at nul.iIIiiIiiiIiI.run(ajb:13)
 
Top