WWW connection refused crashes game build

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:

	private IEnumerator CheckVersionCoroutine() {
		string url = "http://XXXX:8081/";
		
		string wwwArgs = "?";
		wwwArgs += "cmd=" + "verCheck";
		wwwArgs += "&ver=" + GameVersion.Version;
				
		WWW wwwReq = new WWW(url + wwwArgs);
		
		yield return wwwReq;
		if (wwwReq.error != null) {
			Logging.Log(LogLevel.INFO, "Error checking version: "+wwwReq.error);
			yield break;
		}

etc.etc.

Here is the logcat dump:

I/DEBUG   ( 3991): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG   ( 3991): Build fingerprint: 'htc_wwe/htc_ace/ace/ace:2.2.1/FRG83D/296490:user/release-keys'
I/DEBUG   ( 3991): pid: 4558, tid: 4567  >>> dk.fullcontrol.tsur <<<
I/DEBUG   ( 3991): thread: Thread-9
I/DEBUG   ( 3991): signal 11 (SIGSEGV), fault addr 075f32e8
I/DEBUG   ( 3991):  r0 00df2ce8  r1 00a82c98  r2 00a82c98  r3 005d99fc
I/DEBUG   ( 3991):  r4 00a815dc  r5 00000010  r6 00a814b0  r7 075f32e8
I/DEBUG   ( 3991):  r8 075f3318  r9 00a82b58  10 00df2ce8  fp 005d99b8
I/DEBUG   ( 3991):  ip 4ebe5500  sp 4ebe54a4  lr 81139b40  pc 8102f028  cpsr 80000010
I/DEBUG   ( 3991):  d0  6472656767756265  d1  00000000be83ac65
I/DEBUG   ( 3991):  d2  3f3df74c3a727c65  d3  3f80000034000000
I/DEBUG   ( 3991):  d4  c00e423740168501  d5  000000003f919f7f
I/DEBUG   ( 3991):  d6  ff800000ff800000  d7  00000000ff800000
I/DEBUG   ( 3991):  d8  b40000013f800001  d9  00000000b33bbd33
I/DEBUG   ( 3991):  d10 3f80000234000000  d11 0000000034000001
I/DEBUG   ( 3991):  d12 b4000000333bbd2e  d13 000000003f800001
I/DEBUG   ( 3991):  d14 bf9ffbd040168501  d15 000000003f919f80
I/DEBUG   ( 3991):  d16 3feff3041ae39940  d17 3e611d3b63dcfe65
I/DEBUG   ( 3991):  d18 bf56c034de171fd6  d19 3ee51584c35c7f8a
I/DEBUG   ( 3991):  d20 3fa55553e1053a42  d21 3ea51584c35c7f8a
I/DEBUG   ( 3991):  d22 3f9cd496a0000000  d23 3e158f4340000000
I/DEBUG   ( 3991):  d24 3ef99342e0ee5069  d25 3facd496a0000000
I/DEBUG   ( 3991):  d26 3e411622c0000000  d27 3ef99342e0ee5069
I/DEBUG   ( 3991):  d28 0000000000000000  d29 0000000000000000
I/DEBUG   ( 3991):  d30 0000000000000000  d31 0000000000000000
I/DEBUG   ( 3991):  scr 6000001a
I/DEBUG   ( 3991): 
W/System.err( 4558): java.net.ConnectException: xxxx/ip here:port here - Connection refused
W/System.err( 4558): 	at org.apache.harmony.luni.net.PlainSocketImpl.connect(PlainSocketImpl.java:254)
W/System.err( 4558): 	at org.apache.harmony.luni.net.PlainSocketImpl.connect(PlainSocketImpl.java:533)
W/System.err( 4558): 	at java.net.Socket.connect(Socket.java:1055)
W/System.err( 4558): 	at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.<init>(HttpConnection.java:62)
W/System.err( 4558): 	at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnectionPool.get(HttpConnectionPool.java:88)
W/System.err( 4558): 	at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getHTTPConnection(HttpURLConnectionImpl.java:927)
W/System.err( 4558): 	at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:909)
W/System.err( 4558): 	at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:1152)
W/System.err( 4558): 	at com.unity3d.player.WWW.run(Unknown Source)
I/DEBUG   ( 3991):          #00  pc 0002f028  /data/data/dk.fullcontrol.tsur/lib/libunity.so
I/DEBUG   ( 3991):          #01  pc 00139b3c  /data/data/dk.fullcontrol.tsur/lib/libunity.so
I/DEBUG   ( 3991): 
I/DEBUG   ( 3991): code around pc:
I/DEBUG   ( 3991): 8102f008 e4938004 ec97ca03 e0807308 ee0a4a20 
I/DEBUG   ( 3991): 8102f018 ee4a4aa0 ee0b5a20 ecb12a02 e2878030 
I/DEBUG   ( 3991): 8102f028 ecb78a04 ec98ea03 ee0c4a01 ee4c4a81 
I/DEBUG   ( 3991): 8102f038 ee0d5a01 f5d1f400 e1510002 ecb7aa04 
I/DEBUG   ( 3991): 8102f048 eca44a03 eca42a02 3cb10a03 3affffe5 
I/DEBUG   ( 3991): 
I/DEBUG   ( 3991): code around lr:
I/DEBUG   ( 3991): 81139b20 e3a00001 eaffffdb e1a01009 e1a0000a 
I/DEBUG   ( 3991): 81139b30 e1a0300b e58d6000 e0229594 ebfbd51f 
I/DEBUG   ( 3991): 81139b40 eafffff5 e1a01009 e1a0000a e1a0300b 
I/DEBUG   ( 3991): 81139b50 e58d6000 e0229594 ebfbd541 eaffffee 
I/DEBUG   ( 3991): 81139b60 0041b3e8 0000c988 e3510004 13510002 
I/DEBUG   ( 3991): 
I/DEBUG   ( 3991): stack:
I/DEBUG   ( 3991):     4ebe5464  3f800000  
I/DEBUG   ( 3991):     4ebe5468  00000000  
I/DEBUG   ( 3991):     4ebe546c  00000000  
I/DEBUG   ( 3991):     4ebe5470  00000000  
I/DEBUG   ( 3991):     4ebe5474  3f800000  
I/DEBUG   ( 3991):     4ebe5478  00000000  
I/DEBUG   ( 3991):     4ebe547c  00000000  
I/DEBUG   ( 3991):     4ebe5480  3f800000  
I/DEBUG   ( 3991):     4ebe5484  3f800000  
I/DEBUG   ( 3991):     4ebe5488  00000000  
I/DEBUG   ( 3991):     4ebe548c  3f800000  
I/DEBUG   ( 3991):     4ebe5490  00000000  
I/DEBUG   ( 3991):     4ebe5494  00000000  
I/DEBUG   ( 3991):     4ebe5498  e3a070ad  
I/DEBUG   ( 3991):     4ebe549c  ef9000ad  
I/DEBUG   ( 3991):     4ebe54a0  00000000  
I/DEBUG   ( 3991): #01 4ebe54a4  00000014  
I/DEBUG   ( 3991):     4ebe54a8  00000010  
I/DEBUG   ( 3991):     4ebe54ac  00a814b0  [heap]
I/DEBUG   ( 3991):     4ebe54b0  4ebe5610  
I/DEBUG   ( 3991):     4ebe54b4  00000002  
I/DEBUG   ( 3991):     4ebe54b8  00a82b58  [heap]
I/DEBUG   ( 3991):     4ebe54bc  00000000  
I/DEBUG   ( 3991):     4ebe54c0  00000000  
I/DEBUG   ( 3991):     4ebe54c4  3f800000  
I/DEBUG   ( 3991):     4ebe54c8  00000000  
I/DEBUG   ( 3991):     4ebe54cc  00000000  
I/DEBUG   ( 3991):     4ebe54d0  3f800000  
I/DEBUG   ( 3991):     4ebe54d4  3f800000  
I/DEBUG   ( 3991):     4ebe54d8  00000000  
I/DEBUG   ( 3991):     4ebe54dc  00000000  
I/DEBUG   ( 3991):     4ebe54e0  00000000  
I/DEBUG   ( 3991):     4ebe54e4  00000000  
I/DEBUG   ( 3991):     4ebe54e8  00000000  
D/AudioFlinger( 1218): AudioFlinger::PlaybackThread::Track::destroy() name 4096, calling thread 1218
V/AudioPolicyService( 1218): AudioPolicyService::stopOutput()
V/AudioPolicyService( 1218): stopOutput() tid 1319
V/AudioPolicyService( 1218): stopOutput() get autolock tid 1319
V/AudioPolicyManagerBase( 1218): stopOutput() output 1, stream 3

and just the basic snippet for a port 80 query on an non-existing (404) resource:

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

Any clues?

/Thomas

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

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

We’re on it.
Thanks for the bug report.
Not to mention the awesome repro steps :wink:

Tried to make a small repro case, but it didnt trigger the errors. Made a real bug report anyways - thanks D

/T

Thats normal isn’t it. try to repro it and dang - gone
try to use it in real - dang boom :wink:

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 :frowning:

Baaaaaad me

/T