Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
New Contributor
Posts: 7
Registered: ‎03-16-2012
My Device: Several models
My Carrier: Several provider

TcpOutputStream.write waits forever when not in coverage

Hello,

 

I have the following behavior in simulators with OS 6.0.

When I disable 'In Coverage' under network properties a call of flush or close on a tcp output stream waits forever, even when 'In Coverage' is enabled again.

In debugger I see it is always the call of TcpOutputStream.write that waits, see the following stacktrace:

Object.wait() line: 480    
TcpOutputStream.write(byte[], int, int) line: 197    
TcpOutputStream(OutputStream).write(byte[]) line: 61    
TLSRecordProtocol(SSLRecordProtocol).write(int, byte[], int, int) line: 769    
TLSRecordProtocol(SSLRecordProtocol).write(int, DataBuffer) line: 640    
.
.
.

Sometimes this happens already in the the call of flush, sometimes this call does not wait but the following call of close.

I can see this behavior with different simulators running OS 6.0.
With a simulator running 4.7 or hardware devices it does not seem to happen.

What should be the normal behavior when a write operation is called on a tcp stream while the device is out of coverage?

 

Best Regards

BlackBerry Development Advisor
Posts: 15,078
Registered: ‎07-09-2008
My Device: BlackBerry Passport
My Carrier: Bell

Re: TcpOutputStream.write waits forever when not in coverage

The expected behaviour is that an IOException is thrown after 2 minutes when out of coverage.  How long have you waited?

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
New Contributor
Posts: 7
Registered: ‎03-16-2012
My Device: Several models
My Carrier: Several provider

Re: TcpOutputStream.write waits forever when not in coverage

I know about the timeout of 2 minutes for write operations.
I have waited for about twenty minutes.

 

Are you sure that the expected behaviour is that the operations are waiting for 2 minutes before an exception is thrown when the device is out of coverage?

On a 4.7 simulator the operations seem to be canceled  immediately without a 2 minutes timeout.

 

Best Regards

 

BlackBerry Development Advisor
Posts: 15,078
Registered: ‎07-09-2008
My Device: BlackBerry Passport
My Carrier: Bell

Re: TcpOutputStream.write waits forever when not in coverage

Are you seeing this problem on a real device or just in the simulator?  Coverage timeouts for some routes in the simulator are not always 100% accurate compared to a real device.  

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
New Contributor
Posts: 7
Registered: ‎03-16-2012
My Device: Several models
My Carrier: Several provider

Re: TcpOutputStream.write waits forever when not in coverage

At the moment I have only trouble with that issue in simulators running under OS 6.0.

 

I was not able to reproduce this behaviour on several real devices .

 

But I am afraid that my customers running in the problem with real devices.

 

Do you think that this is only a problem with the simulators?

BlackBerry Development Advisor
Posts: 15,078
Registered: ‎07-09-2008
My Device: BlackBerry Passport
My Carrier: Bell

Re: TcpOutputStream.write waits forever when not in coverage

Trust the device over the simulator for in/out of coverage scenarios, especially when toggling the coverage status on the fly (while your app is running).

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Developer
Posts: 33
Registered: ‎10-29-2010
My Device: Not Specified

Re: TcpOutputStream.write waits forever when not in coverage

i got this kind of error too,

im testing in on simulator and device.

when the coverage is changing the tcpoutputstream.write will wait forever, and the screen will stuck and freeze.

Developer
Posts: 19,623
Registered: ‎07-14-2008
My Device: Not Specified

Re: TcpOutputStream.write waits forever when not in coverage

My experience ties in with what Mark was saying, in fact the IO times out after 2 minutes.  Make 100% sure that your processing in the catch for the I/O does indicate that there has been a problem and unfreeze the screen.  You should test this as part of your processing anyway since this will happen on device.