robinjam / ports

Bukkit plugin for creating ports that can transport players around the world
http://dev.bukkit.org/server-mods/ports/
GNU General Public License v3.0
5 stars 5 forks source link

Yaw Exceptions #11

Closed tustin2121 closed 12 years ago

tustin2121 commented 12 years ago

Immediately after I set up a port, I started getting the errors below whenever I walk into a defined port. Now, I know what's causing the bug - my server, for whatever reason, suffers from an on-again-off-again "direction bug", which manifests as the Yaw or Pitch of players reporting as NaN. I don't know why it happens, it causes many annoying bugs during normal gameplay, and I have no fix for it. But, the plugins I've installed thus far have gracefully handled this error, usually storing the NaN value as nothing, 0, or NaN. This is the first time I've gotten rampent stack traces because of it, and due to these errors, your plugin is unfortunately unusable.

This isn't high priority, but if it is possible, please add more graceful error handling for yaw and pitch being NaN. :/

[SEVERE] Could not pass event PLAYER_MOVE to Ports
javax.persistence.PersistenceException: Error loading on net.robinjam.bukkit.ports.persistence.Port.yaw
    at com.avaje.ebeaninternal.server.query.SqlBeanLoad.load(SqlBeanLoad.java:132)
    at com.avaje.ebeaninternal.server.deploy.BeanProperty.load(BeanProperty.java:619)
    at com.avaje.ebeaninternal.server.query.SqlTreeNodeBean.load(SqlTreeNodeBean.java:276)
    at com.avaje.ebeaninternal.server.query.CQuery.readRow(CQuery.java:560)
    at com.avaje.ebeaninternal.server.query.CQuery.readBeanInternal(CQuery.java:594)
    at com.avaje.ebeaninternal.server.query.CQuery.hasNextBean(CQuery.java:720)
    at com.avaje.ebeaninternal.server.query.CQuery.readTheRows(CQuery.java:706)
    at com.avaje.ebeaninternal.server.query.CQuery.readCollection(CQuery.java:673)
    at com.avaje.ebeaninternal.server.query.CQueryEngine.findMany(CQueryEngine.java:204)
    at com.avaje.ebeaninternal.server.query.DefaultOrmQueryEngine.findMany(DefaultOrmQueryEngine.java:104)
    at com.avaje.ebeaninternal.server.core.OrmQueryRequest.findList(OrmQueryRequest.java:344)
    at com.avaje.ebeaninternal.server.core.DefaultServer.findList(DefaultServer.java:1469)
    at com.avaje.ebeaninternal.server.querydefn.DefaultOrmQuery.findList(DefaultOrmQuery.java:906)
    at com.avaje.ebeaninternal.util.DefaultExpressionList.findList(DefaultExpressionList.java:201)
    at net.robinjam.bukkit.ports.PlayerListener.onPlayerMove(PlayerListener.java:34)
    at org.bukkit.plugin.java.JavaPluginLoader$7.execute(JavaPluginLoader.java:302)
    at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:58)
    at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:339)
    at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:180)
    at org.getspout.spout.SpoutNetServerHandler.a(SpoutNetServerHandler.java:615)
    at net.minecraft.server.Packet10Flying.a(SourceFile:126)
    at net.minecraft.server.NetworkManager.b(NetworkManager.java:226)
    at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:92)
    at org.getspout.spout.SpoutNetServerHandler.a(SpoutNetServerHandler.java:501)
    at net.minecraft.server.NetworkListenThread.a(SourceFile:108)
    at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:471)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:374)
    at net.minecraft.server.ThreadServerApplication.run(SourceFile:417)
Caused by: java.lang.RuntimeException: setIntercept yaw on [net.robinjam.bukkit.ports.persistence.Port] arg[null] type[net.robinjam.bukkit.ports.persistence.Port$$EntityBean$Ports] threw error
    at com.avaje.ebeaninternal.server.deploy.BeanProperty.setValueIntercept(BeanProperty.java:843)
    at com.avaje.ebeaninternal.server.query.SqlBeanLoad.load(SqlBeanLoad.java:122)
    ... 27 more
Caused by: java.lang.NullPointerException
    at net.robinjam.bukkit.ports.persistence.Port$$EntityBean$Ports._ebean_setFieldIntercept(Port.java:1)
    at com.avaje.ebeaninternal.server.reflect.EnhanceBeanReflect$Setter.setIntercept(EnhanceBeanReflect.java:184)
    at com.avaje.ebeaninternal.server.deploy.BeanProperty.setValueIntercept(BeanProperty.java:833)
    ... 28 more
robinjam commented 12 years ago

Looks like a null value got inserted into the database when it shouldn't have been :/

I've added some more validations that should stop this from happening in the future - could you download this development build and give it a try? Please delete the "port" table from your database first, and let Ports re-create it. (Or delete the Ports.db file from your plugins directory if you're using sqlite)

http://ci.robinjam.net/job/Ports/69/artifact/target/ports-0.2-SNAPSHOT.jar

tustin2121 commented 12 years ago

Well, upon the direction bug appearing again (like I said, on-again-off-again) I got the below when attempting to make a port. It still reports as an internal error (which I guess it is). Is this what you were going for? (Note: the [PLAYERCMD] is my plugin, not yours, but I included it to show my command. Also, I got a stack trace from my LogCompactor plugin (as of yet unreleased) that I now have to fix, but that's not your problem :) )

Also, I managed to set up two ports just fine while the direction bug was off filing its nails. And, before, I didn't get an internal error when defining ports, only when linking them. So... I guess it worked? (Also, using sqlite)

2011-11-15 13:12:30 [INFO] [PLAYERCMD] tustin2121: /port create test1
2011-11-15 13:12:30 [INFO] Can not test connection as heartbeatsql is not set
2011-11-15 13:12:30 [INFO] Closing Connection[Ports.0] psReuse[41270] psCreate[11] psSize[11]
2011-11-15 13:12:30 [INFO] DataSourcePool [Ports] grow; id[Ports.2] busy[3] max[20]
tustin2121 commented 12 years ago

Also, teleportation isn't affected by lack of Pitch and/or Yaw, only creation. But you probably figured that. :P

robinjam commented 12 years ago

I think what was happening before was, when you used the /port create command, it inserted your current location into the database as the port's arrival location. But since your yaw was null, the plugin got an exception the next time it tried to read that row from the database.

Now /port create should throw an exception if your pitch or yaw is null, rather than blindly inserting it into the database.

I'm really not sure why your server's reporting the wrong pitch/yaw, I thought that bug was fixed in CraftBukkit months ago :/

Let's try some troubleshooting - what build of CraftBukkit are you using? What version of Java are you using? Is it Sun or OpenJDK?

tustin2121 commented 12 years ago

Oh, this WAS a bug in Craftbukkit then? I didn't know that! I thought it was just my server acting weird with the port forwarding and stuff. Ok, so your plugin is fixed. :)

As for my craftbukkit, I've finally updated to 1337 about a week ago. I'm running... I think Sun java, though I could be wrong... on a ubuntu server. Ubuntu 10.

robinjam commented 12 years ago

Well I think it was a bug in vanilla Minecraft but it affected CraftBukkit too. I think it was fixed round about build 700 though, so you shouldn't have been affected :/

If you get any more exceptions please let me know, otherwise I'll close this issue :)