Search Unity

WWW connection refused crashes game build

Discussion in 'Android' started by Thomas-Lund, May 5, 2011.

  1. Thomas-Lund

    Thomas-Lund

    Joined:
    Jan 18, 2008
    Posts:
    465
    Hi,

    This is my very very first attempt on Unity with Android - so I'm uncertain if I do something stupidly wrong or if this is a real bugger.

    The issue I run into is, that I attempt to call a server via WWW class that is (knowingly) now responding on a port. I get a Connection refused (as expected) - but instead of continuing running the game, the build simply crashes.

    If I change the port, so that its actually connecting to a live host (but still a resource that doesnt exist) I get a FileNotFound - and a crash.

    I'm running a development build, so it should have forced internet access.

    Here is the code snippet:
    Code (csharp):
    1.  
    2.     private IEnumerator CheckVersionCoroutine() {
    3.         string url = "http://XXXX:8081/";
    4.        
    5.         string wwwArgs = "?";
    6.         wwwArgs += "cmd=" + "verCheck";
    7.         wwwArgs += "&ver=" + GameVersion.Version;
    8.                
    9.         WWW wwwReq = new WWW(url + wwwArgs);
    10.        
    11.         yield return wwwReq;
    12.         if (wwwReq.error != null) {
    13.             Logging.Log(LogLevel.INFO, "Error checking version: "+wwwReq.error);
    14.             yield break;
    15.         }
    16.  
    17. etc.etc.
    18.  
    19.  

    Here is the logcat dump:

    Code (csharp):
    1.  
    2. I/DEBUG   ( 3991): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
    3. I/DEBUG   ( 3991): Build fingerprint: 'htc_wwe/htc_ace/ace/ace:2.2.1/FRG83D/296490:user/release-keys'
    4. I/DEBUG   ( 3991): pid: 4558, tid: 4567  >>> dk.fullcontrol.tsur <<<
    5. I/DEBUG   ( 3991): thread: Thread-9
    6. I/DEBUG   ( 3991): signal 11 (SIGSEGV), fault addr 075f32e8
    7. I/DEBUG   ( 3991):  r0 00df2ce8  r1 00a82c98  r2 00a82c98  r3 005d99fc
    8. I/DEBUG   ( 3991):  r4 00a815dc  r5 00000010  r6 00a814b0  r7 075f32e8
    9. I/DEBUG   ( 3991):  r8 075f3318  r9 00a82b58  10 00df2ce8  fp 005d99b8
    10. I/DEBUG   ( 3991):  ip 4ebe5500  sp 4ebe54a4  lr 81139b40  pc 8102f028  cpsr 80000010
    11. I/DEBUG   ( 3991):  d0  6472656767756265  d1  00000000be83ac65
    12. I/DEBUG   ( 3991):  d2  3f3df74c3a727c65  d3  3f80000034000000
    13. I/DEBUG   ( 3991):  d4  c00e423740168501  d5  000000003f919f7f
    14. I/DEBUG   ( 3991):  d6  ff800000ff800000  d7  00000000ff800000
    15. I/DEBUG   ( 3991):  d8  b40000013f800001  d9  00000000b33bbd33
    16. I/DEBUG   ( 3991):  d10 3f80000234000000  d11 0000000034000001
    17. I/DEBUG   ( 3991):  d12 b4000000333bbd2e  d13 000000003f800001
    18. I/DEBUG   ( 3991):  d14 bf9ffbd040168501  d15 000000003f919f80
    19. I/DEBUG   ( 3991):  d16 3feff3041ae39940  d17 3e611d3b63dcfe65
    20. I/DEBUG   ( 3991):  d18 bf56c034de171fd6  d19 3ee51584c35c7f8a
    21. I/DEBUG   ( 3991):  d20 3fa55553e1053a42  d21 3ea51584c35c7f8a
    22. I/DEBUG   ( 3991):  d22 3f9cd496a0000000  d23 3e158f4340000000
    23. I/DEBUG   ( 3991):  d24 3ef99342e0ee5069  d25 3facd496a0000000
    24. I/DEBUG   ( 3991):  d26 3e411622c0000000  d27 3ef99342e0ee5069
    25. I/DEBUG   ( 3991):  d28 0000000000000000  d29 0000000000000000
    26. I/DEBUG   ( 3991):  d30 0000000000000000  d31 0000000000000000
    27. I/DEBUG   ( 3991):  scr 6000001a
    28. I/DEBUG   ( 3991):
    29. W/System.err( 4558): java.net.ConnectException: xxxx/ip here:port here - Connection refused
    30. W/System.err( 4558):    at org.apache.harmony.luni.net.PlainSocketImpl.connect(PlainSocketImpl.java:254)
    31. W/System.err( 4558):    at org.apache.harmony.luni.net.PlainSocketImpl.connect(PlainSocketImpl.java:533)
    32. W/System.err( 4558):    at java.net.Socket.connect(Socket.java:1055)
    33. W/System.err( 4558):    at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.<init>(HttpConnection.java:62)
    34. W/System.err( 4558):    at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnectionPool.get(HttpConnectionPool.java:88)
    35. W/System.err( 4558):    at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getHTTPConnection(HttpURLConnectionImpl.java:927)
    36. W/System.err( 4558):    at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:909)
    37. W/System.err( 4558):    at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:1152)
    38. W/System.err( 4558):    at com.unity3d.player.WWW.run(Unknown Source)
    39. I/DEBUG   ( 3991):          #00  pc 0002f028  /data/data/dk.fullcontrol.tsur/lib/libunity.so
    40. I/DEBUG   ( 3991):          #01  pc 00139b3c  /data/data/dk.fullcontrol.tsur/lib/libunity.so
    41. I/DEBUG   ( 3991):
    42. I/DEBUG   ( 3991): code around pc:
    43. I/DEBUG   ( 3991): 8102f008 e4938004 ec97ca03 e0807308 ee0a4a20
    44. I/DEBUG   ( 3991): 8102f018 ee4a4aa0 ee0b5a20 ecb12a02 e2878030
    45. I/DEBUG   ( 3991): 8102f028 ecb78a04 ec98ea03 ee0c4a01 ee4c4a81
    46. I/DEBUG   ( 3991): 8102f038 ee0d5a01 f5d1f400 e1510002 ecb7aa04
    47. I/DEBUG   ( 3991): 8102f048 eca44a03 eca42a02 3cb10a03 3affffe5
    48. I/DEBUG   ( 3991):
    49. I/DEBUG   ( 3991): code around lr:
    50. I/DEBUG   ( 3991): 81139b20 e3a00001 eaffffdb e1a01009 e1a0000a
    51. I/DEBUG   ( 3991): 81139b30 e1a0300b e58d6000 e0229594 ebfbd51f
    52. I/DEBUG   ( 3991): 81139b40 eafffff5 e1a01009 e1a0000a e1a0300b
    53. I/DEBUG   ( 3991): 81139b50 e58d6000 e0229594 ebfbd541 eaffffee
    54. I/DEBUG   ( 3991): 81139b60 0041b3e8 0000c988 e3510004 13510002
    55. I/DEBUG   ( 3991):
    56. I/DEBUG   ( 3991): stack:
    57. I/DEBUG   ( 3991):     4ebe5464  3f800000  
    58. I/DEBUG   ( 3991):     4ebe5468  00000000  
    59. I/DEBUG   ( 3991):     4ebe546c  00000000  
    60. I/DEBUG   ( 3991):     4ebe5470  00000000  
    61. I/DEBUG   ( 3991):     4ebe5474  3f800000  
    62. I/DEBUG   ( 3991):     4ebe5478  00000000  
    63. I/DEBUG   ( 3991):     4ebe547c  00000000  
    64. I/DEBUG   ( 3991):     4ebe5480  3f800000  
    65. I/DEBUG   ( 3991):     4ebe5484  3f800000  
    66. I/DEBUG   ( 3991):     4ebe5488  00000000  
    67. I/DEBUG   ( 3991):     4ebe548c  3f800000  
    68. I/DEBUG   ( 3991):     4ebe5490  00000000  
    69. I/DEBUG   ( 3991):     4ebe5494  00000000  
    70. I/DEBUG   ( 3991):     4ebe5498  e3a070ad  
    71. I/DEBUG   ( 3991):     4ebe549c  ef9000ad  
    72. I/DEBUG   ( 3991):     4ebe54a0  00000000  
    73. I/DEBUG   ( 3991): #01 4ebe54a4  00000014  
    74. I/DEBUG   ( 3991):     4ebe54a8  00000010  
    75. I/DEBUG   ( 3991):     4ebe54ac  00a814b0  [heap]
    76. I/DEBUG   ( 3991):     4ebe54b0  4ebe5610  
    77. I/DEBUG   ( 3991):     4ebe54b4  00000002  
    78. I/DEBUG   ( 3991):     4ebe54b8  00a82b58  [heap]
    79. I/DEBUG   ( 3991):     4ebe54bc  00000000  
    80. I/DEBUG   ( 3991):     4ebe54c0  00000000  
    81. I/DEBUG   ( 3991):     4ebe54c4  3f800000  
    82. I/DEBUG   ( 3991):     4ebe54c8  00000000  
    83. I/DEBUG   ( 3991):     4ebe54cc  00000000  
    84. I/DEBUG   ( 3991):     4ebe54d0  3f800000  
    85. I/DEBUG   ( 3991):     4ebe54d4  3f800000  
    86. I/DEBUG   ( 3991):     4ebe54d8  00000000  
    87. I/DEBUG   ( 3991):     4ebe54dc  00000000  
    88. I/DEBUG   ( 3991):     4ebe54e0  00000000  
    89. I/DEBUG   ( 3991):     4ebe54e4  00000000  
    90. I/DEBUG   ( 3991):     4ebe54e8  00000000  
    91. D/AudioFlinger( 1218): AudioFlinger::PlaybackThread::Track::destroy() name 4096, calling thread 1218
    92. V/AudioPolicyService( 1218): AudioPolicyService::stopOutput()
    93. V/AudioPolicyService( 1218): stopOutput() tid 1319
    94. V/AudioPolicyService( 1218): stopOutput() get autolock tid 1319
    95. V/AudioPolicyManagerBase( 1218): stopOutput() output 1, stream 3
    96.  
    and just the basic snippet for a port 80 query on an non-existing (404) resource:

    Code (csharp):
    1.  
    2. W/System.err( 4658): java.io.FileNotFoundException: http://XXX/blabla?cmd=verCheck&ver=1.2
    3. W/System.err( 4658):    at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:1162)
    4. W/System.err( 4658):    at com.unity3d.player.WWW.run(Unknown Source)
    5. I/DEBUG   ( 3991):          #00  pc 0002f028  /data/data/dk.fullcontrol.tsur/lib/libunity.so
    6. I/DEBUG   ( 3991):          #01  pc 00139b3c  /data/data/dk.fullcontrol.tsur/lib/libunity.so
    7. I/DEBUG   ( 3991):
    8. I/DEBUG   ( 3991): code around pc:
    9. I/DEBUG   ( 3991): 8102f008 e4938004 ec97ca03 e0807308 ee0a4a20
    10. I/DEBUG   ( 3991): 8102f018 ee4a4aa0 ee0b5a20 ecb12a02 e2878030
    11. I/DEBUG   ( 3991): 8102f028 ecb78a04 ec98ea03 ee0c4a01 ee4c4a81
    12. I/DEBUG   ( 3991): 8102f038 ee0d5a01 f5d1f400 e1510002 ecb7aa04
    13. I/DEBUG   ( 3991): 8102f048 eca44a03 eca42a02 3cb10a03 3affffe5
    14.  
    Any clues?

    /Thomas
     
  2. Thomas-Lund

    Thomas-Lund

    Joined:
    Jan 18, 2008
    Posts:
    465
    Commenting out the version check successfully continues operating the build.

    A few lines further on we also grab (via WWW) a file containing news ticker test - works perfectly fine too.

    So seems like a bug?!

    /T
     
  3. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    Seems definitely like an android bug. Never seen it on iOS, web or standalone where we had unreachable webservice etc often enough to have hit this for sure
     
  4. neonleif

    neonleif

    Joined:
    Feb 25, 2009
    Posts:
    29
    We're on it.
    Thanks for the bug report.
    Not to mention the awesome repro steps ;-)
     
  5. Thomas-Lund

    Thomas-Lund

    Joined:
    Jan 18, 2008
    Posts:
    465
    Tried to make a small repro case, but it didnt trigger the errors. Made a real bug report anyways - thanks D

    /T
     
  6. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    Thats normal isn't it. try to repro it and dang - gone
    try to use it in real - dang boom ;)
     
  7. Thomas-Lund

    Thomas-Lund

    Joined:
    Jan 18, 2008
    Posts:
    465
    Sooo true - I have too many of these. And sometimes I must also admit to not reporting at all when I have things like this where the repro case is either too complicated to do or doesnt trigger the bug :-(

    Baaaaaad me

    /T