Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

port out of range:65536

Help
2009-11-30
2012-12-06
  • core when try to save any *.hs file:

    org.eclipse.core.internal.resources.ResourceException(/): java.lang.IllegalArgumentException: port out of range:65536
    at java.net.InetSocketAddress.<init>(InetSocketAddress.java:83)
    at java.net.Socket.<init>(Socket.java:209)
    at net.sf.eclipsefp.haskell.scion.internal.client.ScionServer.startServerProcess(ScionServer.java:119)
    at net.sf.eclipsefp.haskell.scion.internal.client.ScionServer.startServer(ScionServer.java:68)
    at net.sf.eclipsefp.haskell.scion.client.ScionInstance.start(ScionInstance.java:94)
    at net.sf.eclipsefp.haskell.ui.internal.scion.ScionManager.startInstance(ScionManager.java:326)
    at net.sf.eclipsefp.haskell.ui.internal.scion.ScionManager.updateForResource(ScionManager.java:301)
    at net.sf.eclipsefp.haskell.ui.internal.scion.ScionManager.access$4(ScionManager.java:295)
    at net.sf.eclipsefp.haskell.ui.internal.scion.ScionManager$2.visit(ScionManager.java:99)
    at org.eclipse.core.internal.resources.Resource$2.visit(Resource.java:108)
    at org.eclipse.core.internal.resources.Resource$1.visitElement(Resource.java:60)
    at org.eclipse.core.internal.watson.ElementTreeIterator.doIteration(ElementTreeIterator.java:82)
    at org.eclipse.core.internal.watson.ElementTreeIterator.iterate(ElementTreeIterator.java:120)
    at org.eclipse.core.internal.resources.Resource.accept(Resource.java:70)
    at org.eclipse.core.internal.resources.Resource.accept(Resource.java:106)
    at org.eclipse.core.internal.resources.Resource.accept(Resource.java:90)
    at net.sf.eclipsefp.haskell.ui.internal.scion.ScionManager.start(ScionManager.java:96)
    at net.sf.eclipsefp.haskell.ui.HaskellUIPlugin.start(HaskellUIPlugin.java:77)
    at org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:782)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:773)
    at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:754)
    at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:352)
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:280)
    at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:408)
    at org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:111)
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:449)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:211)
    at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:376)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:452)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:405)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:393)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:105)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
    at org.eclipse.osgi.internal.loader.BundleLoader.loadClass(BundleLoader.java:321)
    at org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:231)
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass(AbstractBundle.java:1193)
    at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:160)
    at org.eclipse.core.internal.registry.ExtensionRegistry.createExecutableExtension(ExtensionRegistry.java:874)
    at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:243)
    at org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:51)
    at org.eclipse.ui.internal.WorkbenchPlugin$1.run(WorkbenchPlugin.java:267)
    at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
    at org.eclipse.ui.internal.WorkbenchPlugin.createExtension(WorkbenchPlugin.java:263)
    at org.eclipse.ui.internal.registry.EditorDescriptor.createEditor(EditorDescriptor.java:235)
    at org.eclipse.ui.internal.EditorManager.createPart(EditorManager.java:845)
    at org.eclipse.ui.internal.EditorReference.createPartHelper(EditorReference.java:606)
    at org.eclipse.ui.internal.EditorReference.createPart(EditorReference.java:462)
    at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:595)
    at org.eclipse.ui.internal.EditorAreaHelper.setVisibleEditor(EditorAreaHelper.java:271)
    at org.eclipse.ui.internal.EditorManager.setVisibleEditor(EditorManager.java:1417)
    at org.eclipse.ui.internal.EditorManager$5.runWithException(EditorManager.java:942)
    at org.eclipse.ui.internal.StartupThreading$StartupRunnable.run(StartupThreading.java:31)
    at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
    at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:134)
    at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3855)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3476)
    at org.eclipse.ui.application.WorkbenchAdvisor.openWindows(WorkbenchAdvisor.java:803)
    at org.eclipse.ui.internal.Workbench$28.runWithException(Workbench.java:1384)
    at org.eclipse.ui.internal.StartupThreading$StartupRunnable.run(StartupThreading.java:31)
    at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
    at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:134)
    at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3855)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3476)
    at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2316)
    at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2221)
    at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:493)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:368)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
    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 org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:559)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1311)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1287)

    gch: 6.10.4;<br>
    last version of scion-server.exe;<br>
    OS: Windows 7; firewall / antivirus disabled; <br>

    I have decompiled your ScionServer.class to investigate the problem myself<br>and find the code:<br>
    try
            {
                do
                {
                    new Socket(InetAddress.getLocalHost(), port);
                    port++;
                } while(true);
            }
            catch(IOException _ex)
            { // normal behavior
               …. <br>
       Then I create test project and check creation of socket new <br>Socket(InetAddress.getLocalHost(), port). On my machine this <br>socket is created without any IOException for ANY port. <br>
    When I try  new Socket(InetAddress.getByName("localhost"), port)<br>
    the constructor throws<br>
    java.net.ConnectException: Connection refused: connect
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
    at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)<br>
      It is strange, but looks like InetAddress.getByName("localhost") and InetAddress.getLocalHost() - are different hosts %)<br>

     
  • JP Moresmau
    JP Moresmau
    2009-12-01

    Java: write once, debug everywhere (-:. <br/>Of course I never had any issue with that code (I'm on XP). Yes, I think you're right, "localhost" is one thing, and InetAddress.getLocalHost() is another, probably the network name of your machine. So the code should check for both. <br/>
    That loop is there because by default the Scion server reuses ports, so if you have several projects you end up with only one listening Scion instance.<br>
    I'll try to get the fix in later today (I'm in Europe). You can get the source from http://github.com/JPMoresmau/eclipsefp, easier than decompiling.

     
  • JP Moresmau
    JP Moresmau
    2009-12-02

    I have committed on github a new version that uses null as the address to check the port, which is consistent with the use of null as the address to connect to the server. Can you check that new Socket(null, port) fails correctly if there is nothing listening on that port on your machine? If it does, take the source from github, should fix your problem

     
  • Thank you for quick reply :) <br>
    I have donloaded sources and correct net.sf.eclipsefp.haskell.scion.internal.client.ScionServer<br>
    according to your recomendations. <br>

    But now another problem. <br>

    Strange things with this java.net.Socket on my machine.. It refuses to connect <br>
    to scion-server.exe no matter what host and port I try!<br>

    First I must say, scion-server.exe I have built using cabal.exe downloaded here<br>
    http://haskell.org/cabal/download.html<br>
    After launch scion-server.exe print message to standard output:<br>
    starting server<br>
    opts: StartupConfig {connectionMode = TCPIP False 4005, autoPort = False, showHelp = False}<br>
    === Listening on port: 4005<br>
    Then, if use utility netstat we can get next information:<br>
    …<br>
    TCP    :4005              GreenTea-PC:0          LISTENING       4588<br>
    …<br>

    Then I create simple java application:<br>
    public static void main(String args)<br>
    {<br>
    Socket socket = null;<br>
    try {<br>
    socket = new Socket((String)null, 4005);<br>
    } catch (UnknownHostException e) {<br>
    e.printStackTrace();<br>
    } catch (IOException e) {<br>
    e.printStackTrace();<br>
    System.out.println("IOException");<br>
    }<br>
    finally<br>
    {<br>
    if (socket != null)<br>
    {<br>
    try {<br>
    socket.close();<br>
    } catch (IOException e) {<br>
    e.printStackTrace();<br>
    }<br>
    }
    }
    }<br>

    And try different combinations of arguments to Socket constructor:<br>
    null, "localhost", "", "greentea-pc" etc <br>
    result always the same<br>
    java.net.ConnectException: Connection refused: connect<br>
    at java.net.PlainSocketImpl.socketConnect(Native Method)<br>
    at java.net.PlainSocketImpl.doConnect(Unknown Source)<br>
    at java.net.PlainSocketImpl.connectToAddress(Unknown Source)<br>
    at java.net.PlainSocketImpl.connect(Unknown Source)<br>
    at java.net.SocksSocketImpl.connect(Unknown Source)<br>
    at java.net.Socket.connect(Unknown Source)<br>
    at java.net.Socket.connect(Unknown Source)<br>
    at java.net.Socket.<init>(Unknown Source)<br>
    at java.net.Socket.<init>(Unknown Source)<br>
    at net.sf.eclipsefp.haskell.scion.internal.client.ScionServer.main(ScionServer.java:368)<br>
    IOException<br>

    Interesting, that almost for all other ports which are also shown by utility netstat<br>
    Socket is connected successfully. Maybe something wrong with scion-server.exe?<br>

     
  • P.S.
    C# sample application connects successfully

          static void Main(string args)
          {
             Socket s = new Socket(AddressFamily.InterNetworkV6, SocketType.Stream, ProtocolType.Tcp);
             s.Connect("localhost", 4005);
             s.Close();
          }

     
  • JP Moresmau
    JP Moresmau
    2009-12-03

    AddressFamily.InterNetworkV6… You're on IPV6? Maybe scion-server needs to be compiled with specific flags. I see in the GHC sources: (Network.hs): #if defined(IPV6 _ SOCKET _ SUPPORT) So maybe you need to compile scion with that flag defined.<br/>
    Anyway you're right, you need to be able to connect to scion-server before you can hope to use EclipseFP.
    Search for Haskell and IPv6 (things like http://hackage.haskell.org/trac/ghc/ticket/2391). Unfortunately I do not have IPv6 here so I can't help much… Sorry!! Maybe contact the scion mailing list as well, see if Nominolo has experience on IPv6.