Error loading SFE module (port out of range)

Thus spake Joel Uckelman:

I looked at the Launch4j source and found my answer: It reads the JRE
location form the Windows registry (see findJavaHome()):

launch4j.cvs.sourceforge.net/lau … iew=markup

As it happens, I should have thought of that, because I’ve already
coded something once which does it: our Windows installer.

Ok, so that mystery is solved. I can fix this now.


J.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

Personally, as a late uptaker, I have found very few problems with Vista. Most issues now seem to be user problems :slight_smile:

Perhaps the maximum JVM heap size limit is being blown. The manager should print the JVM size it is attempting to set into the logfile when attempting to start up an Editor or Player. From memory, the limit is 1350M on XP, but only 1300M on Vista. If the user has bumped it up to maximum on XP, this would cause this error on Vista.

B.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

Dear Joel,

please write a message if I should test it with a new SVN version.

Best Regards and th@nx for the great programm.

Chris

Thus spake “Biswut”:

svn3936 reads the location of the java executable from the Windows
Registry (blech!). This worked on the XP machine where I tested it.
Please try this on Vista.


J.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

Dear Joel,

sorry, it didn’t work:

[505003912]
– OS Windows Vista
– Java version 1.6.0_07
– VASSAL version 3.1.0-svn3936
– Manager
Could not create the Java virtual machine.
[505003912]
java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: port out of range:1165128303
at java.util.concurrent.FutureTask$Sync.innerGet(Unknown Source)
at java.util.concurrent.FutureTask.get(Unknown Source)
at org.jdesktop.swingworker.SwingWorker.get(Unknown Source)
at VASSAL.launch.AbstractLaunchAction$LaunchTask.done(AbstractLaunchAction.java:385)
at VASSAL.launch.Player$LaunchAction$1.done(Player.java:185)
at org.jdesktop.swingworker.SwingWorker$5.run(Unknown Source)
at org.jdesktop.swingworker.SwingWorker$DoSubmitAccumulativeRunnable.run(Unknown Source)
at org.jdesktop.swingworker.AccumulativeRunnable.run(Unknown Source)
at org.jdesktop.swingworker.SwingWorker$DoSubmitAccumulativeRunnable.actionPerformed(Unknown Source)
at javax.swing.Timer.fireActionPerformed(Unknown Source)
at javax.swing.Timer$DoPostEvent.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.lang.IllegalArgumentException: port out of range:1165128303
at java.net.InetSocketAddress.(Unknown Source)
at java.net.Socket.(Unknown Source)
at VASSAL.launch.AbstractLaunchAction$LaunchTask.doInBackground(AbstractLaunchAction.java:373)
at VASSAL.launch.AbstractLaunchAction$LaunchTask.doInBackground(AbstractLaunchAction.java:169)
at org.jdesktop.swingworker.SwingWorker$1.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at org.jdesktop.swingworker.SwingWorker.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

Best regards
Chris

Thus spake “Biswut”:

Could you try this build?

nomic.net/~uckelman/tmp/vass … indows.exe

It’s going to fail, too, but the errorLog will contain some additional
diagnostic information for us.


J.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

Hi Joel,
here is the log:

[618055800]
– OS Windows Vista
– Java version 1.6.0_07
– VASSAL version 3.1.0-svn3940
– Manager
C:\Program Files\Java\jre1.6.0_07\bin\java -Xms1024M -Xmx2048M -cp lib\Vengine.jar;Vengine.jar VASSAL.launch.Player
Could not create the Java virtual machine.
[618055800]
java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: port out of range:1165128303
at java.util.concurrent.FutureTask$Sync.innerGet(Unknown Source)
at java.util.concurrent.FutureTask.get(Unknown Source)
at org.jdesktop.swingworker.SwingWorker.get(Unknown Source)
at VASSAL.launch.AbstractLaunchAction$LaunchTask.done(AbstractLaunchAction.java:331)
at VASSAL.launch.Player$LaunchAction$1.done(Player.java:184)
at org.jdesktop.swingworker.SwingWorker$5.run(Unknown Source)
at org.jdesktop.swingworker.SwingWorker$DoSubmitAccumulativeRunnable.run(Unknown Source)
at org.jdesktop.swingworker.AccumulativeRunnable.run(Unknown Source)
at org.jdesktop.swingworker.SwingWorker$DoSubmitAccumulativeRunnable.actionPerformed(Unknown Source)
at javax.swing.Timer.fireActionPerformed(Unknown Source)
at javax.swing.Timer$DoPostEvent.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.lang.IllegalArgumentException: port out of range:1165128303
at java.net.InetSocketAddress.(Unknown Source)
at java.net.Socket.(Unknown Source)
at VASSAL.launch.AbstractLaunchAction$LaunchTask.doInBackground(AbstractLaunchAction.java:319)
at VASSAL.launch.AbstractLaunchAction$LaunchTask.doInBackground(AbstractLaunchAction.java:173)
at org.jdesktop.swingworker.SwingWorker$1.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at org.jdesktop.swingworker.SwingWorker.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

Ok,

There’s the problem. A maximum heap size of 2048 Mb is WAY to big for either XP or Vista. In 3.1, this is set from the preferences in the module, which you cannot adjust without loading the module.

Joel, I think we need at least a warning on the Max heap size that any value over 1300 Mb is liable to crash on some systems. Perhaps even make 1300 the limit. (I think 1300 is the smallest I have heard of.

In the meantime, you can get out of this by hand editing or deleting your preferences. In ~/VASSAL is a file called Preferences. Rename it to Preferences.zip and open it up. You will find one file for each module you have ever started. Either delete the SFE entry, or you can extract it and edit it to change the 2048 to 1300, then put it back and rename teh preferences back to ‘Preferences’.

Regards,
Brent.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

I’m not thinking straight. The preferences are per-machine of course. We need a stringly worded warning based on the OS of the machine. I believe the limit is 1350 for Vista and 1300 for Windows.

B.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

Thus spake “Brent Easton”:

Yes, we need to do something about this. Does this limit hold regardless
of how much RAM the machine has? on 64-bit Vista also? Is this documented
anywhere?


J.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

Thus spake Joel Uckelman:

I think I’ve found the answer to my questions: No. Don’t know. No.

Summary:

In theory, you should be able to have 4GB of heap on a 32-bit system, but
a huge chunk of that address space is reserved by Windows. This is further
complicated by the utterly brain-dead practice of using pre-defined memory
address for DLLs on Windows. This is a problem for the JVM, because it wants
its heap in one contiguous block of memory. You can “rebase” DLLs to move
them out of the way, but that’s a manual process and permanent, so doing
that might screw things up when you’re using other apps.

forums.sun.com/thread.jspa?threa … forumID=37
bugs.sun.com/bugdatabase/view_bu … id=4358809

So, it looks like the limit is going to vary from machine to machine,
depending entirely on what DLLs Windows happens to have loaded at the
time. (Have I mentioned yet how completely addled this is? Argh!) Since
it’s possible for us to check whehter the spawned JVM is running, and
when it fails this way it fails fast, we could handle this situation
on the fly:

  1. Try running with the curent heap settings.
  2. If the JVM barfs, scale back the max heap by some percentage.
  3. Goto 1.

If we aren’t able to launch the JVM on the first go, then we should
notify the user that we are running with a reduced max heap, and that
he might want to lower his max heap in the Preferences. This way, a
bad setting is recoverable without the need for the user to manually
edit hte Preferences file.

It occurred to me just not that you could end up with a similar problem
with setting your max heap so low that you can’t get to the Preferences
dialog in order to change it—so we should do something about that as
well.

How does this sound as a solution?


J.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

Wow. I learned something astounding today.

  • M.

Post generated using Mail2Forum (mail2forum.com)

Thus spake “Michael Kiefte”:

Ok, so now I’m investigating ways to determine empirically how large
the max heap can be. I found a rather surprising result using Sun’s
64-bit JVM on Linux: The least max heap size which causes the JVM to
complain is 133395456 MB. Now, I don’t have nearly 128 TB (!) of
storage, so apparently on 64-bit Linux we don’t need to worry about
people typing in overlarge max heaps (unless we think it’s likely that
they’ll accidentally type numbers in excess of 9 digits).


J.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

I’m attaching a small program which I created to test how the JVM handles
the maximum heap size on various OSes and architectures. I’d appreciate
it if everyone following this thread would try it and post their results,
especially anyone with a Vista box. (or a Mac, as I have no idea what this
will be like there).

To run the program:

  1. Unzip the ZIP archive. You should get a directory called “find-max-heap”,
    containing Test.class, Foo.class, Test.java, and Foo.java.

  2. Go to that directory in a terminal (“cd path/to/find-max-heap”).

  3. Run “java Test”.

  4. You should get some diagnostic output in your terminal (and possibly
    some error output).

  5. Please report back with the last six lines of output, how much RAM
    you have, and whether you’re on a 32- or 64-bit machine. Here’s what I
    found:

For my 64-bit Linux machine, 2GB RAM:

java.home = /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre
java.version = 1.6.0
os.name = Linux
os.version = 2.6.25.11-97.fc9.x86_64
os.arch = amd64
maxheap = 133167599

For my wife’s 32-bit Windows XP machine, 512MB RAM:

java.home = C:\Program Files\Java\jre1.6.0_07
java.version = 1.6.0_07
os.name = Windows XP
os.version = 5.1
os.arch = x86
maxheap = 1612

Dear Joel,
first of all th@nx for your support, it seems to me that in my case the problem was again in front of the computer.
If course I changed the setting and I didn’t tell if (because I already forgot it).

I have a vista 32-bit with 4 GB (of couse onlx 3582 MB are used in this configuration).

My six lines are:

java.home = c:\Program Files\Java\jre1.6.0_07
java.version = 1.6.0_07
os.name = Windows Vista
os.version = 6.0
os.arch = x86
maxheap = 1602

I will also use it on my Ubuntu system later.

Chris

HI Joel,
here comes Ubuntu, 2 GB:

java.home = /usr/lib/jvm/java-6-open-jdk/jre
java.version = 1.6.0
os.name = Linux
os.version = 2.6.24-19-generic
os.arch = i386
maxheap = 2678

Best regards
Chris

Interesting result.

First one worked fine on Vista32 3GB Laptop:

retval = 0, maxheap = 128
retval = 0, maxheap = 256
retval = 0, maxheap = 512
retval = 0, maxheap = 1024
retval = 1, maxheap = 2048
lb = 1024, ub = 2048
retval = 0, maxheap = 1536
lb = 1536, ub = 2048
retval = 1, maxheap = 1792
lb = 1536, ub = 1792
retval = 1, maxheap = 1664
lb = 1536, ub = 1664
retval = 1, maxheap = 1600
lb = 1536, ub = 1600
retval = 0, maxheap = 1568
lb = 1568, ub = 1600
retval = 0, maxheap = 1584
lb = 1584, ub = 1600
retval = 0, maxheap = 1592
lb = 1592, ub = 1600
retval = 1, maxheap = 1596
lb = 1592, ub = 1596
retval = 0, maxheap = 1594
lb = 1594, ub = 1596
retval = 1, maxheap = 1595
java.home = C:\Program Files\Java\jre1.6.0_05
java.version = 1.6.0_05
os.name = Windows Vista
os.version = 6.0
os.arch = x86
maxheap = 1594

Second one on XP64 4GB dies and would not complete?:

retval = 0, maxheap = 128
retval = 0, maxheap = 256
retval = 0, maxheap = 512
retval = 0, maxheap = 1024
retval = 0, maxheap = 2048
retval = 0, maxheap = 4096
retval = 0, maxheap = 8192
retval = 0, maxheap = 16384
retval = 0, maxheap = 32768
retval = 0, maxheap = 65536
retval = 0, maxheap = 131072
retval = 0, maxheap = 262144
retval = 0, maxheap = 524288
retval = 0, maxheap = 1048576
retval = 0, maxheap = 2097152
retval = 1, maxheap = 4194304
lb = 2097152, ub = 4194304
retval = 0, maxheap = 3145728
lb = 3145728, ub = 4194304
retval = 1, maxheap = 3670016
lb = 3145728, ub = 3670016
retval = 1, maxheap = 3407872
lb = 3145728, ub = 3407872
retval = 1, maxheap = 3276800
lb = 3145728, ub = 3276800
retval = 1, maxheap = 3211264
lb = 3145728, ub = 3211264
retval = 1, maxheap = 3178496
lb = 3145728, ub = 3178496
retval = 1, maxheap = 3162112
lb = 3145728, ub = 3162112
retval = 0, maxheap = 3153920
lb = 3153920, ub = 3162112
retval = 1, maxheap = 3158016
lb = 3153920, ub = 3158016
retval = 0, maxheap = 3155968
lb = 3155968, ub = 3158016
retval = 1, maxheap = 3156992
lb = 3155968, ub = 3156992
retval = 1, maxheap = 3156480
lb = 3155968, ub = 3156480
retval = 0, maxheap = 3156224
lb = 3156224, ub = 3156480
retval = 1, maxheap = 3156352
lb = 3156224, ub = 3156352
retval = 1, maxheap = 3156288
lb = 3156224, ub = 3156288
retval = 0, maxheap = 3156256
lb = 3156256, ub = 3156288
retval = 0, maxheap = 3156272
lb = 3156272, ub = 3156288
retval = 0, maxheap = 3156280
lb = 3156280, ub = 3156288
retval = 0, maxheap = 3156284
lb = 3156284, ub = 3156288
retval = 0, maxheap = 3156286
lb = 3156286, ub = 3156288

Post generated using Mail2Forum (mail2forum.com)

Thus spake “Tim McCaron”:

This is fascinating. It seems that the 64-bit systems behave completely
differently from the 32-bit ones in this respect. I can’t account for
why the 64-bit JVMs would accept some heap sizes vastly beyond what
could ever be allocated, but not all.

That’s wierd… It looks like 3156287MB is your boundary.


J.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

uckelman wrote:

Powerbook G4, 2G physical:

java.home = /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home
java.version = 1.5.0_13
os.name = Mac OS X
os.version = 10.4.11
os.arch = ppc
maxheap = 2108

Cheers,
Tim.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

uckelman wrote:

Powerbook G4, 2G physical:

java.home = /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home
java.version = 1.5.0_13
os.name = Mac OS X
os.version = 10.4.11
os.arch = ppc
maxheap = 2108

Cheers,
Tim.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)