Replacement JAR for b89 for UPNP testing (Apr 12)

Notes on testing the latest builds of MapTool

Moderators: dorpond, trevor, Azhrei

User avatar
CoveredInFish
Demigod
Posts: 3104
Joined: Mon Jun 29, 2009 10:37 am
Location: Germany
Contact:

Re: Replacement JAR for b89 for UPNP testing (Apr 12)

Post by CoveredInFish »

Okay, back to this.

I followed the instructions, redownloaded all, renamed according the instructions.

When I Start A Server nothing happens, no server is started, no error msg. When I try to end MT after that this
exception
java.lang.reflect.UndeclaredThrowableException
at com.sun.proxy.$Proxy0.handleQuit(Unknown Source)
at com.apple.eawt._AppEventLegacyHandler$7.dispatchEvent(_AppEventLegacyHandler.java:146)
at com.apple.eawt._AppEventLegacyHandler.sendEventToEachListenerUntilHandled(_AppEventLegacyHandler.java:168)
at com.apple.eawt._AppEventLegacyHandler.handleQuitRequestWith(_AppEventLegacyHandler.java:144)
at com.apple.eawt._AppEventHandler$_QuitDispatcher.performUsing(_AppEventHandler.java:387)
at com.apple.eawt._AppEventHandler$_QuitDispatcher.performUsing(_AppEventHandler.java:380)
at com.apple.eawt._AppEventHandler$_AppEventDispatcher$1.run(_AppEventHandler.java:489)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:708)
at java.awt.EventQueue.access$400(EventQueue.java:82)
at java.awt.EventQueue$2.run(EventQueue.java:669)
at java.awt.EventQueue$2.run(EventQueue.java:667)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:678)
at net.rptools.maptool.client.swing.MapToolEventQueue.dispatchEvent(MapToolEventQueue.java:38)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at net.rptools.maptool.client.ui.OSXAdapter.callTarget(OSXAdapter.java:154)
at net.rptools.maptool.client.ui.OSXAdapter.invoke(OSXAdapter.java:165)
... 22 more
Caused by: java.lang.NoClassDefFoundError: net/sbbi/upnp/messages/UPNPResponseException
at net.rptools.maptool.client.MapTool.disconnect(MapTool.java:1021)
at net.rptools.maptool.client.ui.MapToolFrame.close(MapToolFrame.java:1334)
at net.rptools.maptool.client.ui.MapToolFrame.closingMaintenance(MapToolFrame.java:1329)
at net.rptools.maptool.client.AppActions$66.execute(AppActions.java:2578)
at net.rptools.maptool.client.ui.MapToolFrame.macOSXExit(MapToolFrame.java:406)
... 28 more
Caused by: java.lang.ClassNotFoundException: net.sbbi.upnp.messages.UPNPResponseException
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 33 more
is thrown. I cant end MT .. I have to terminate it.

Log attached.
Attachments
log.txt
(6.17 KiB) Downloaded 86 times

User avatar
Azhrei
Site Admin
Posts: 12086
Joined: Mon Jun 12, 2006 1:20 pm
Location: Tampa, FL

Re: Replacement JAR for b89 for UPNP testing (Apr 12)

Post by Azhrei »

Thanks, CiF.

This problem is starting to vex me. :?

I have one router that works using the stock firmware. That router doesn't have some of the fields that are reported by wolph and CiF so it's not a good test (but it does work with both MapTool and a torrent client I have, Transmission).

Another router is running OpenWRT and MiniUPnPd/1.8 (the latest version of that UPNP server). When I run Transmission it can open a port on that router using either UPNP or NAT-PMP (I can control the server so it accepts one and not the other and I've tested both). But MapTool can't even get a response back from the query it sends out looking for routers! Looking at the logs on the router, it never even sees the request coming in (and that explains why it doesn't respond, I guess :roll: ).

I need to take a break from this. I've push my changed to GitHub if anyone with some network experience wants to take a look at it. I can provide two .pcap files for tcpdump or wireshark as well. I'll come back later and upload a new JAR file for others to test because clearly my router is not cooperating!

User avatar
JamzTheMan
Great Wyrm
Posts: 1872
Joined: Mon May 10, 2010 12:59 pm
Location: Chicagoland
Contact:

Re: Replacement JAR for b89 for UPNP testing (Apr 12)

Post by JamzTheMan »

Az, I can't remember, is this upnp issue Java version specific? Always worked with java 1.6, and java 1.7 is the issue?

I only ask because it's been working fine for me with 1.7, but due to the NPE issue, I went back to 1.6 for my game yesterday and noticed I got a upnp issue starting the server. I just unchecked and continued on since it was game night. But I can take another look tonight and provide logs if it helps.
-Jamz
____________________
Custom MapTool 1.4.x.x Fork: maptool.nerps.net
Custom TokenTool 2.0 Fork: tokentool.nerps.net
More information here: MapTool Nerps! Fork

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: Replacement JAR for b89 for UPNP testing (Apr 12)

Post by wolph42 »

JamzTheMan wrote:Az, I can't remember, is this upnp issue Java version specific? Always worked with java 1.6, and java 1.7 is the issue?

I only ask because it's been working fine for me with 1.7, but due to the NPE issue, I went back to 1.6 for my game yesterday and noticed I got a upnp issue starting the server. I just unchecked and continued on since it was game night. But I can take another look tonight and provide logs if it helps.
I can run Lee's dev version both in j6 and j7.17 and the upnp works. Azh jar replacements however keeps throwing errors...

User avatar
Azhrei
Site Admin
Posts: 12086
Joined: Mon Jun 12, 2006 1:20 pm
Location: Tampa, FL

Re: Replacement JAR for b89 for UPNP testing (Apr 12)

Post by Azhrei »

I grabbed his test setup. It works on my WR841N with stock firmware, but not on the one reflashed with OpenWRT. I tried both J6 and J7.

That means I'm going to stop banging my head on the wall with the OpenWRT router. I'll try flashing DD-WRT later. I'll get a new test JAR uploaded later tonight.

User avatar
jfrazierjr
Deity
Posts: 5176
Joined: Tue Sep 11, 2007 7:31 pm

Re: Replacement JAR for b89 for UPNP testing (Apr 12)

Post by jfrazierjr »

Azhrei wrote:I grabbed his test setup. It works on my WR841N with stock firmware, but not on the one reflashed with OpenWRT. I tried both J6 and J7.

That means I'm going to stop banging my head on the wall with the OpenWRT router. I'll try flashing DD-WRT later. I'll get a new test JAR uploaded later tonight.
Interesting. At what stage does this fail with OpenWRT? I have not really dug into the "flow" of how UPnP works, so if you have some time, could you outline the basic process flow within the code? Eventually, I will do it myself, but who knows when that will be(likely the weekend of the 26th since my wife is going out of town and I will have some free time..)
I save all my Campaign Files to DropBox. Not only can I access a campaign file from pretty much any OS that will run Maptool(Win,OSX, linux), but each file is versioned, so if something goes crazy wild, I can always roll back to a previous version of the same file.

Get your Dropbox 2GB via my referral link, and as a bonus, I get an extra 250 MB of space. Even if you don't don't use my link, I still enthusiastically recommend Dropbox..

User avatar
Azhrei
Site Admin
Posts: 12086
Joined: Mon Jun 12, 2006 1:20 pm
Location: Tampa, FL

Re: Replacement JAR for b89 for UPNP testing (Apr 12)

Post by Azhrei »

Basic overview of UPNP:
  1. When router is turned on it starts broadcasting its availability as an InternetGatewayDevice (IGD) and continues to do so periodically.
  2. When MapTool starts up it hasn't seen any of these broadcasts so it sends a UDP search packet that looks like web traffic ("M-SEARCH * HTTP/1.1" and "ST: urn:schemas-upnp-org:device:InternetGatewayDevice:1" are two of the important lines).
  3. All IGDs on the subnet are supposed to respond with a UDP packet that says, "I'm here and this is the URL to use to retrieve my root XML descriptor".
  4. MapTool hears that message and starts talking to the router at the URL it provided. My OpenWRT says to use http://192.168.1.1:5000/getRootDesc.xml as the URL, so MapTool sends that request using TCP.
  5. Lots of traffic goes back and forth with MT making requests of the information it needs.
  6. One of the URLs provided in the root descriptor is the one used to control the port forwarding. MT crafts the SOAP message that says to open the port (and how) and sends it to that URL as an HTTP POST message.
  7. A response comes back as to whether it worked or not.
  8. When MT shuts down, it sends a packet to any routers that it configured for UPNP and tells them to delete the mapping.
OpenWRT fails because it never sends out the broadcast and never responds to the search query. At some point I'll reflash an older build where it works. But for now I've bricked my router so I need to open it up and solder a few wires to make a serial cable so I can bring it back from the dead. That's really low on my priority list right now though.

User avatar
Azhrei
Site Admin
Posts: 12086
Joined: Mon Jun 12, 2006 1:20 pm
Location: Tampa, FL

Re: Replacement JAR for b89 for UPNP testing (Apr 12)

Post by Azhrei »

Okay, I meant to have this done a few nights ago but things have been busy.

I've updated the OP with version 1.0.8 of the library. Please try this one out.

Since I bricked my last router and haven't wanted to take the time to solder a serial connector onto it, I simply bought two new ones. (The WR1043ND is great, btw. NewEgg.com has them for $50 and these wireless routers include a USB2.0 port to hook up external drives and/or printers and they provide network-based media server and printer/scan server software.)

Unfortunately, I tried flashing one of the new ones with Gargoyle and bricked that one too. My luck is in the toilet right now. :roll: So I'm not playing with router firmware until I get back from my business trip next week so you folks will need to do the testing...

User avatar
CoveredInFish
Demigod
Posts: 3104
Joined: Mon Jun 29, 2009 10:37 am
Location: Germany
Contact:

Re: Replacement JAR for b89 for UPNP testing (Apr 12)

Post by CoveredInFish »

Now luck.

Still no server started, have to force-quit MT to end.
exception

Code: Select all

java.lang.reflect.UndeclaredThrowableException
	at com.sun.proxy.$Proxy0.handleQuit(Unknown Source)
	at com.apple.eawt._AppEventLegacyHandler$7.dispatchEvent(_AppEventLegacyHandler.java:146)
	at com.apple.eawt._AppEventLegacyHandler.sendEventToEachListenerUntilHandled(_AppEventLegacyHandler.java:168)
	at com.apple.eawt._AppEventLegacyHandler.handleQuitRequestWith(_AppEventLegacyHandler.java:144)
	at com.apple.eawt._AppEventHandler$_QuitDispatcher.performUsing(_AppEventHandler.java:387)
	at com.apple.eawt._AppEventHandler$_QuitDispatcher.performUsing(_AppEventHandler.java:380)
	at com.apple.eawt._AppEventHandler$_AppEventDispatcher$1.run(_AppEventHandler.java:489)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:708)
	at java.awt.EventQueue.access$400(EventQueue.java:82)
	at java.awt.EventQueue$2.run(EventQueue.java:669)
	at java.awt.EventQueue$2.run(EventQueue.java:667)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:678)
	at net.rptools.maptool.client.swing.MapToolEventQueue.dispatchEvent(MapToolEventQueue.java:38)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Caused by: java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at net.rptools.maptool.client.ui.OSXAdapter.callTarget(OSXAdapter.java:154)
	at net.rptools.maptool.client.ui.OSXAdapter.invoke(OSXAdapter.java:165)
	... 22 more
Caused by: java.lang.NoClassDefFoundError: net/sbbi/upnp/messages/UPNPResponseException
	at net.rptools.maptool.client.MapTool.disconnect(MapTool.java:1021)
	at net.rptools.maptool.client.ui.MapToolFrame.close(MapToolFrame.java:1334)
	at net.rptools.maptool.client.ui.MapToolFrame.closingMaintenance(MapToolFrame.java:1329)
	at net.rptools.maptool.client.AppActions$66.execute(AppActions.java:2578)
	at net.rptools.maptool.client.ui.MapToolFrame.macOSXExit(MapToolFrame.java:406)
	... 28 more
Caused by: java.lang.ClassNotFoundException: net.sbbi.upnp.messages.UPNPResponseException
	at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
	... 33 more
(I'm not sure if my system is set up for upnp to work fine, but this fails horrible, so me testing might still be a good thing :) )
Attachments
log.txt
(3.25 KiB) Downloaded 88 times

User avatar
Azhrei
Site Admin
Posts: 12086
Joined: Mon Jun 12, 2006 1:20 pm
Location: Tampa, FL

Re: Replacement JAR for b89 for UPNP testing (Apr 12)

Post by Azhrei »

Crud. I'll look through your log and see how it compares to the code. That'll be tomorrow night at the earliest.

(My "honey-do" list now includes re-caulking the shower stall in the master bedroom; should only take an hour or so, but those are the jobs that end up taking a week!)

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: Replacement JAR for b89 for UPNP testing (Apr 12)

Post by wolph42 »

tested it. first didn't remove the "sbbi-upnplib-1.0.5-debug.jar" file and got the usual upnp error. Then removed it and:

IT WORKS !!!!!

User avatar
Azhrei
Site Admin
Posts: 12086
Joined: Mon Jun 12, 2006 1:20 pm
Location: Tampa, FL

Re: Replacement JAR for b89 for UPNP testing (Apr 12)

Post by Azhrei »

Excellent -- thank you!

Edit: I just looked at the log. It appears that it doesn't include the server being shutdown. MapTool used to error out sometimes when shutting down the server -- it was sending a command to the router that it couldn't execute, but that was because the port mapping wasn't working (so removing it obviously couldn't work either). Did you get any errors when shutting down the server?

I've got some more cleanup to do in that code and I want to add some documentation/comments to how some pieces of it work. Then I'll upload it to Github, finish some patches to MT, and put out build b90. Probably still looking at Thurs (I'd like to get any translation updates included).

Whew. What a bummer this was! There were quite a few variables that were used in the wrong place. For example, a variable named deviceCtx would be created, then later deviceListCtx would be created. Later in the function it would use the wrong one. Very difficult to find because of the mass of code involved. (Disclaimer: this is not my code. ;))

Note to self: make variable names different enough to make this kind of bug easier to find in my own code! :roll:

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: Replacement JAR for b89 for UPNP testing (Apr 12)

Post by wolph42 »

i didn't log of the server, but ended the maptool instance at once. I did however try a remote connect and that worked. i can test the server shut down maybe later.


User avatar
Azhrei
Site Admin
Posts: 12086
Joined: Mon Jun 12, 2006 1:20 pm
Location: Tampa, FL

Re: Replacement JAR for b89 for UPNP testing (Apr 12)

Post by Azhrei »

Him, interesting. It appears that MT removes the port mapping and then the UPNP library turns around and tries to retrieve it again. Probably as a check to make sure it's gone. It might be that the failure is being caught and reported with a stacktrce when really it's *expected* to fail and should be handled differently.

I'll take a look at this. Thanks for the log message!

Post Reply

Return to “Testing”