Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Apr 2003
    Location
    Oulu, Finland
    Posts
    6

    Series 60Series 60 MIDP Concept SDK Beta 0.2 Linux bug?

    I have been using the SDK with ant/antenna/WTK2.0beta2 combination in RedHat 7.3 / J2SDK1.4.1_02 environment and it works ok most of the time.

    Usually after two weeks of using I have to reboot my machine because the SDK starts to bug me with an error that is attached below. I can't find anything reasonable what is causing this and only thing that seems to fix this symptom is reboot. I can't find any running processes, tempfiles or anything related to this so that's why I'm currently assuming that the SDK uses a really sick method which uses uptime for guessing "random" free portnumber's or something like that.

    Anyway, when the shit hits the fan, I start getting errors like this when trying to run the emulator. Only the port number varies in different runs:
    Nokia Series 60 MIDP Concept SDK Beta 0.2: java.lang.IllegalArgumentException: Port value out of range: 67249
    Nokia Series 60 MIDP Concept SDK Beta 0.2: at java.net.ServerSocket.<init>(ServerSocket.java:178)
    Nokia Series 60 MIDP Concept SDK Beta 0.2: Emulator command: /home/kauppi/Nokia/Devices/Nokia_Series_60_MIDP_Concept_SDK_Beta_0_2/bin/midp -heapsize 8M -classpath /home/kauppi/Nokia/Devices/Nokia_Series_60_MIDP_Concept_SDK_Beta_0_2/lib/classes.zip:/home/kauppi/myjar.jar -Xdescriptor /home/kauppi/myjar.jad -DcommandPort=58249 -DmirrorPort=58250
    Nokia Series 60 MIDP Concept SDK Beta 0.2: at java.net.ServerSocket.<init>(ServerSocket.java:95)
    Nokia Series 60 MIDP Concept SDK Beta 0.2: at s60midpbh.e([DashoPro-V1.32-013000])
    Nokia Series 60 MIDP Concept SDK Beta 0.2: at s60midpbh.c([DashoPro-V1.32-013000])
    Nokia Series 60 MIDP Concept SDK Beta 0.2: at s60midpm.d([DashoPro-V1.32-013000])
    Nokia Series 60 MIDP Concept SDK Beta 0.2: java.lang.IllegalArgumentException
    Nokia Series 60 MIDP Concept SDK Beta 0.2: at s60midpm.run([DashoPro-V1.32-013000])
    Nokia Series 60 MIDP Concept SDK Beta 0.2: at com.sun.cldc.io.j2me.socket.Protocol.openPrim(+7)
    Nokia Series 60 MIDP Concept SDK Beta 0.2: at java.lang.Thread.run(Thread.java:536)
    Nokia Series 60 MIDP Concept SDK Beta 0.2: at com.sun.midp.io.InternalConnector.openPrim(+332)
    Nokia Series 60 MIDP Concept SDK Beta 0.2: java.lang.IllegalArgumentException: Port value out of range: 67250
    Nokia Series 60 MIDP Concept SDK Beta 0.2: at com.sun.midp.io.InternalConnector.open(+28)
    Nokia Series 60 MIDP Concept SDK Beta 0.2: at java.net.ServerSocket.<init>(ServerSocket.java:178)
    Nokia Series 60 MIDP Concept SDK Beta 0.2: at javax.microedition.io.Connector.open(+6)
    Nokia Series 60 MIDP Concept SDK Beta 0.2: at java.net.ServerSocket.<init>(ServerSocket.java:95)
    Nokia Series 60 MIDP Concept SDK Beta 0.2: at javax.microedition.io.Connector.open(+6)
    Nokia Series 60 MIDP Concept SDK Beta 0.2: at s60midpbh.e([DashoPro-V1.32-013000])
    Nokia Series 60 MIDP Concept SDK Beta 0.2: at javax.microedition.io.Connector.open(+5)
    Nokia Series 60 MIDP Concept SDK Beta 0.2: at s60midpbh.c([DashoPro-V1.32-013000])
    Nokia Series 60 MIDP Concept SDK Beta 0.2: at com.nokia.phone.sdk.concept.util.io.bridge.CLIBridge.ensureConnection(+28)
    Nokia Series 60 MIDP Concept SDK Beta 0.2: at s60midpm.d([DashoPro-V1.32-013000])
    Nokia Series 60 MIDP Concept SDK Beta 0.2: at com.nokia.phone.sdk.concept.util.io.bridge.CLIBridge.getOutputStream(+4)
    Nokia Series 60 MIDP Concept SDK Beta 0.2: at s60midpm.run([DashoPro-V1.32-013000])
    Nokia Series 60 MIDP Concept SDK Beta 0.2: at com.nokia.phone.sdk.concept.gateway.MirrorSocketClient.ensureConnection(+51)
    Nokia Series 60 MIDP Concept SDK Beta 0.2: at java.lang.Thread.run(Thread.java:536)
    Nokia Series 60 MIDP Concept SDK Beta 0.2: at com.nokia.phone.sdk.concept.gateway.MirrorSocketClient.sendInvocation(+10)
    Nokia Series 60 MIDP Concept SDK Beta 0.2: at com.sun.midp.io.j2me.storage.RandomAccessStream.connect(+58)
    Nokia Series 60 MIDP Concept SDK Beta 0.2: at com.sun.midp.dev.DevMIDletSuiteImpl.initialize(+42)
    Nokia Series 60 MIDP Concept SDK Beta 0.2: at com.sun.midp.dev.DevMIDletSuiteImpl.<init>(+32)
    Nokia Series 60 MIDP Concept SDK Beta 0.2: at com.sun.midp.Main.runLocalClass(+15)
    Nokia Series 60 MIDP Concept SDK Beta 0.2: at com.sun.midp.Main.main(+68)
    Nokia Series 60 MIDP Concept SDK Beta 0.2: java.lang.IllegalArgumentException
    Nokia Series 60 MIDP Concept SDK Beta 0.2: at com.sun.cldc.io.j2me.socket.Protocol.openPrim(+7)
    Nokia Series 60 MIDP Concept SDK Beta 0.2: at com.sun.midp.io.InternalConnector.openPrim(+332)
    Nokia Series 60 MIDP Concept SDK Beta 0.2: at com.sun.midp.io.InternalConnector.open(+28)
    Nokia Series 60 MIDP Concept SDK Beta 0.2: at javax.microedition.io.Connector.open(+6)
    Nokia Series 60 MIDP Concept SDK Beta 0.2: at javax.microedition.io.Connector.open(+6)
    Nokia Series 60 MIDP Concept SDK Beta 0.2: at javax.microedition.io.Connector.open(+5)
    Nokia Series 60 MIDP Concept SDK Beta 0.2: at com.nokia.phone.sdk.concept.util.io.bridge.CLIBridge.ensureConnection(+28)
    Nokia Series 60 MIDP Concept SDK Beta 0.2: at com.nokia.phone.sdk.concept.util.io.bridge.CLIBridge.getInputStream(+4)
    Nokia Series 60 MIDP Concept SDK Beta 0.2: at com.nokia.phone.sdk.concept.gateway.MirrorSocketClient.ensureConnection(+69)
    Nokia Series 60 MIDP Concept SDK Beta 0.2: at com.nokia.phone.sdk.concept.gateway.MirrorSocketClient.sendInvocation(+10)
    Nokia Series 60 MIDP Concept SDK Beta 0.2: at com.sun.midp.io.j2me.storage.RandomAccessStream.connect(+58)
    Nokia Series 60 MIDP Concept SDK Beta 0.2: at com.sun.midp.dev.DevMIDletSuiteImpl.initialize(+42)
    Nokia Series 60 MIDP Concept SDK Beta 0.2: at com.sun.midp.dev.DevMIDletSuiteImpl.<init>(+32)
    Nokia Series 60 MIDP Concept SDK Beta 0.2: at com.sun.midp.Main.runLocalClass(+15)
    Nokia Series 60 MIDP Concept SDK Beta 0.2: at com.sun.midp.Main.main(+68)
    Nokia Series 60 MIDP Concept SDK Beta 0.2: java.lang.NullPointerException
    Nokia Series 60 MIDP Concept SDK Beta 0.2: at com.nokia.phone.sdk.concept.gateway.MirrorProtocol$MBInputStream.reset(+12)
    Nokia Series 60 MIDP Concept SDK Beta 0.2: at com.nokia.phone.sdk.concept.gateway.MirrorProtocol.initInputPacket(+13)
    Nokia Series 60 MIDP Concept SDK Beta 0.2: at com.sun.midp.io.j2me.storage.RandomAccessStream.connect(+67)
    Nokia Series 60 MIDP Concept SDK Beta 0.2: at com.sun.midp.dev.DevMIDletSuiteImpl.initialize(+42)
    Nokia Series 60 MIDP Concept SDK Beta 0.2: at com.sun.midp.dev.DevMIDletSuiteImpl.<init>(+32)
    Nokia Series 60 MIDP Concept SDK Beta 0.2: at com.sun.midp.Main.runLocalClass(+15)
    Nokia Series 60 MIDP Concept SDK Beta 0.2: at com.sun.midp.Main.main(+68)


    Any ideas how to fix this without rebooting?
    Any ideas why this is happening (bug?)

    __
    Ari
    Last edited by kauppi; 2003-04-02 at 14:16.

  2. #2
    Regular Contributor
    Join Date
    Mar 2003
    Location
    Helsinki.FI
    Posts
    112
    Ari,

    thanks for your detailed problem report. We looked into this issue and it seems that this is related to the JVM implementation on Linux. The port is not selected at random but instead the port value is increased by one each time the SDK is started. The port selection is handled by JVM.

    The reason why you must reboot your machine is the implementation of java.net.ServerSocket (and beyond). Each time the emulator is started, it tries to reserve ports that are not used by your current environment.

    In the environment point of view this seems that someone is asking a free port for accepting connections. If a java program asks for a free port, the returned port number increases between
    executions. However, the data field for the port number is only (unsigned) 16-bit wide (maximum is 65535)... and when this value is reached the result is a malfunction.

    Kind regards,
    Tinke / FN

  3. #3
    Registered User
    Join Date
    Apr 2003
    Location
    Oulu, Finland
    Posts
    6
    Hi,

    Yes, the problem is clearly in socket binding. I did a small test which uses ServerSocket(0) 100000 times in a row to create sockets. After some test runs I am confident that JVM is allocating free ports correctly, it iswrapping back to 32768 after 61000. When creating sockets with automatic allocation JVM is asking kernel to allocate port numbers so if the problem would lie in automatic port allocation it would be a kernel problem. If you want more proof of this, I can email my small test program and logs separately.

    When looking at my problem report more carefully, I noticed the emulator is started with -DcommandPort=58249 but the incorrect port is 67249. With different runs there still seems to be a difference of 9000 so that would indicate to me that a port is allocated automatically but after that 9000 is added to that port number and a then there's an attempt to open another ServerSocket for that port and it is not checked whether the port is >65535?

    Of course, I don't know whether that addition of 9000 is done in JVM or SDK but I'd really appreciate it if you could fix this or find a workaround. So I am sorry but rebooting is a microsoft-way sort of solution for this problem unless you call this a feature.

    __
    Ari

  4. #4
    Regular Contributor
    Join Date
    Mar 2003
    Location
    Helsinki.FI
    Posts
    112
    Hi Ari,

    you are right. We are sorry for any inconvenience this may have caused and the bug you reported will be fixed for the future releases. Thank you for your analysis and feedback.

    Kind regards,
    Tinke / FN

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×