CraftBook 3

CraftBook 3

139k Downloads

All Midi ICs show weird behavior

LadyCailinBot opened this issue ยท 44 comments

commented

CRAFTBOOK-2857 - Reported by jojo1541

Hi there, i have a little problem with all midi playing ICs. This includes MC1277, MC1270 and MC1273.

The Radius doesn't seem to work with this ICs anymore. They stop playing after leaving a radius about 8 blocks around the IC (despite a radius of 15, 20 or higher) and won't continue playing after reentering it. Instead they spam the messages on the playlist or in case of 1270 'playing [Songname]'.

commented

Comment by me4502

With the radius being smaller,do you have the IC max radius set low in your config?

commented

Comment by jojo1541

oh and i'm using Craftbook 3.8-Snapshot:3555-7ab7624.

Edit: The max Radius for ICs in the config is 200.

Edit 2: Ok, I just checked the files and it seems that another admin changed the radius down to 10. (Actually he deleted my old config file X_X) Explains the radius issue for my Melody players.
But it doesn't change anything for the radio. After leaving the radius i have to reset the Radiostation (1276) to get the radioICs working again.

Edit 3: Ok it seems that once the radio is broken the melody players will break as soon as you leave their playing radius. I've got an error this time too. Is there any spcecific way to post an errorlog or just as a comment?

commented

Comment by me4502

The second error is due to a java midi sequencer issue, the rest I've fixed.

commented

Comment by me4502

Try the melody on build 3602.

commented

Comment by jojo1541

Well, with 3602 the melody doesn't play anything again. (not even the chat message)
And as soon as i try using a radio the Levers cause extreme lagspikes (10 - 20 seconds).

commented

Comment by me4502

What were you using prior? Radios haven't changed.

commented

Comment by me4502

Try next build.

commented

Comment by jojo1541

I've ben using 3599 prior to 3602. 3604 didn't change anything for the melody. The radio still causes lagspikes after starting the playlist.

commented

Comment by me4502

Does #3605 work?

commented

Comment by jojo1541

sadly not. Melody players won't work and i guess there is a memory leak somewhere. The server doesn't lag like i assumed, it gets totally overloaded. It won't react to console commands at all and wont even show the characters i type anymore. And after some time it get this error:

[Server thread/WARN]: [CraftBook] CraftBook mechanic: Failed to think for (269.0, 64.0, 262.0)
[Server thread/ERROR]: [CraftBook] java.lang.OutOfMemoryError: Java heap space

commented

Comment by me4502

The one that overloaded, is that a Melody IC?

commented

Comment by jojo1541

yes, it was the melody player (1270).

commented

Comment by me4502

I've just made a slight change. I'll properly look into it tomorrow when not on an iPad, but that change may have fixed it mostly

commented

Comment by me4502

Try the latest build, I believe it is fixed and working perfectly now.

commented

Comment by jojo1541

The melody player is working for me now. :)
Still no luck with the radio though.

commented

Comment by jojo1541

Any suggestions for the radio?^^

commented

Comment by me4502

I'm still looking into that. It for me sometimes works and sometimes doesn't. Most of the time it works, so it's hard to test for it faili

commented

Comment by jojo1541

well, ok then. If i encounter an error i'll post it here.

commented

Comment by jojo1541

It isn't an error, but i think i narrowed it down a little bit. With the current build and debug-flags enabled mc1270 always starts spamming after the midi-file is finished. Before that it works perfectly fine. (If you turn it off and on again, it plays perfectly again until the song ends)
With LOOP it works fine until you disable the ic again. If you disable it, it spams the 'constructing player instance' and 'starting run of player instance' messages until you destroy the sign or turn it on again. (Then it continues working as if nothing had happened at all)
With Start the behaviour is the same as normal except that it spams even after you turned it off and on again. (it continues spamming as soon as you turn it on again).
Maybe there is an issue with resseting the position of the sequencer after the song ends? (It spams in this order: 'finished playing for: jojo1541', 'Adding jojo1541 to melody IC', 'Playing sequencer for player: jojo1541')
In case you knew all of this already, just ignore me. :D

commented

Comment by me4502

I'll look into those midi issues next chance I get

commented

Comment by me4502

Is this still a valid issue?

commented

Comment by me4502

Hmm, I'll look into these issues next chance I get. There were a few issues earlier with the way the midi sequencers actually work, which may be attributing to this.

commented

Comment by jojo1541

Tanks for looking into it.
I have narrowed down the issue with my melody players. if you leave the current world while it's playing it (sometimes) wont work on your return. (At least for me) But nothing new for the radio station.

commented

Comment by me4502

Try using the latest build, it may have accidentally fixed it.

commented

Comment by jojo1541

With the new build the ICs won't do anything as soon as I add a radius to them. Without a radius it works just fine, but with it even the chatmessage 'now playing [...]' won't be displayed. (With the RadioIC nothing happens at all. Neither Text from the Playlist nor music.)

commented

Comment by me4502

Are you sure? It works absolutely fine for me now?

commented

Comment by jojo1541

Ok, so after i found and used the latest unstable build(It's not that easy to find them ^^) i now have the same Issue as before. Sometimes when i leave the radius and reenter it spams again and giving me following error. I tried this on a test server with nothing but worldedit and craftbook installed so there aren't any incompabitilities with other plugins.

Error:

org.apache.commons.lang.UnhandledException: Plugin CraftBook v3.8-SNAPSHOT:3593-96c2d3a,master generated an exception while executing task 527
at org.bukkit.craftbukkit.v1_7_R1.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:56)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
at com.sk89q.craftbook.circuits.gates.world.miscellaneous.Melody$MelodyPlayer.run(Melody.java:233)
at org.bukkit.craftbukkit.v1_7_R1.scheduler.CraftTask.run(CraftTask.java:53)
at org.bukkit.craftbukkit.v1_7_R1.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:53)
... 3 more

commented

Comment by me4502

The org.apache.commons there could be the issue, are you using OpenJDK? It's midi sequencer may not be as good as oracles.

commented

Comment by jojo1541

I got my JDK from the oracle homepage and use ver. 7, Update 51.
I didn't even know there was an open source version of Java until now.^^

Edit: Just wanted to mention that i don't always get the error, just sometimes.

commented

Comment by me4502

Well i have fixed that specific error, but it's not related to the main issue

commented

Comment by jojo1541

Hmm, that was the only error message i got. I could make a video showing the phenomenon but i don't think would help much.^^
I have no idea what causes this error. I've tried a new clean config, clean bukkit install etc. but nothing helps solving it. I wont even get an error.

commented

Comment by me4502

I will keep looking into it.
Did the build that fixed the error also fix the issue by some random unlikely occurance?

commented

Comment by jojo1541

The latest build solved the issue with the melody player. The IC continued playing during my tests. Thanks for the fixing that. :)
The only issue remaining are the radio ICs. they still won't continue playing after leaving their radius.

Edit: Ok, it isn't solved. After trying the radio it spammed again. Same after a restart. This time it threw an error though.

Error(s):

[JingleNotePlayer for jojo1541/ERROR]: [CraftBook] java.lang.NullPointerException
at com.sk89q.craftbook.circuits.jinglenote.MidiJingleSequencer.run(MidiJingleSequencer.java:100)
at com.sk89q.craftbook.circuits.jinglenote.MidiJingleSequencer.play(MidiJingleSequencer.java:265)
at com.sk89q.craftbook.circuits.jinglenote.JingleNotePlayer.run(JingleNotePlayer.java:40)
at java.lang.Thread.run(Unknown Source)

[23:51:20] [JingleNotePlayer for jojo1541/ERROR]: [CraftBook] java.lang.IllegalStateException: sequencer not open
at com.sun.media.sound.RealTimeSequencer.start(Unknown Source)
at com.sk89q.craftbook.circuits.jinglenote.MidiJingleSequencer.run(MidiJingleSequencer.java:146)
at com.sk89q.craftbook.circuits.jinglenote.MidiJingleSequencer.play(MidiJingleSequencer.java:265)
at com.sk89q.craftbook.circuits.jinglenote.JingleNotePlayer.run(JingleNotePlayer.java:40)
at java.lang.Thread.run(Unknown Source)

[23:51:20] [pool-3-thread-1/WARN]: Exception in thread "pool-3-thread-1"
[23:51:20] [pool-3-thread-1/WARN]: org.apache.commons.lang.UnhandledException: Plugin CraftBook v3.8-SNAPSHOT:3599-605abd6,master generated an exception while executing task 61
at org.bukkit.craftbukkit.v1_7_R1.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:56)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.util.ConcurrentModificationException
at java.util.LinkedList$ListItr.checkForComodification(Unknown Source)
at java.util.LinkedList$ListItr.next(Unknown Source)
at com.sk89q.craftbook.circuits.gates.world.miscellaneous.Melody$MelodyPlayer.run(Melody.java:224)
at org.bukkit.craftbukkit.v1_7_R1.scheduler.CraftTask.run(CraftTask.java:53)
at org.bukkit.craftbukkit.v1_7_R1.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:53)
... 3 more

commented

Comment by jojo1541

For me yes. I would like to use the Radio and Melodyplayers for my server.

commented

Comment by me4502

So they are still broken?

commented

Comment by jojo1541

jup, with the newest build everything is just as i described it 4 posts above.

commented

Comment by me4502

Please test latest build, I believe I have fixed those issues.

commented

Comment by jojo1541

Ok, it works so far and is playing. But the melody ic is now looping even without the 'LOOP' flag and after leaving the radius it wont start playing again until I switch it off and on again. And I think there is a memory leak. As soon as you play a midi with the 'LOOP' flag, the server gets continually slower until it wont even accept the 'stop' command anymore.

commented

Comment by me4502

I'm looking into it now, it seems like it'll take a while to fix.

commented

Comment by jojo1541

Take your time. I can wait.^^

commented

Comment by me4502

Test the latest build, I believe it all works now.

commented

Comment by jojo1541

Great Work Sir. :)
Finally working on my server.
There are only two little things i'd like to adress now (But they are as important as a sack of rice falling over in China):
First: With the 'START' parameter the Melody wont stop after the song is finished.
Second: After leaving the Radius of a normal Melody (without LOOP) the song just ends.
The Radio and the Jukebox are working fine for me now, too.

So thanks for your patience and persistence with this issue.
Best regards, JoJo1541.

commented

Comment by me4502

Hrm, so ;START causes endless loop?

And leaving the radius ends it, as midi sequencers can't play when there is no output device, therefore the song ends.

commented

Comment by jojo1541

Well, no. With START it wont set it's output to low after finishing a Song.
About the 'normal' mode, just ignore me. I had a redstone circuit underneath the IC that turned it on again without realising it. X_X
Just like START it wont change its output to low though.