finestructure / Graf

1 stars 0 forks source link

Make sure we always time out #10

Closed finestructure closed 12 years ago

finestructure commented 12 years ago

Currently, it can happen that the connection closes prematurely but we only report back to VVC when a decode or upload event occurs. This can lead to items remaining in the kProcessing state indefinitely.

finestructure commented 12 years ago

We still sit in processing state indefinitely. Example sequence:

2012-02-01 10:21:35.359 Graf[1211:707] Refresh started for image: 1579fd4a7aa5f7d739b68696d886ef63 2012-02-01 10:21:35.361 Graf[1211:707] worker connected to host api.deathbycaptcha.com:8130 2012-02-01 10:21:35.363 Graf[1211:707] call: login 2012-02-01 10:21:35.365 Graf[1211:707] request byte count: 64 2012-02-01 10:21:35.636 Graf[1211:707] Stream opened 2012-02-01 10:21:35.637 Graf[1211:707] Has space available 2012-02-01 10:21:35.639 Graf[1211:707] Worker executing upload command 2012-02-01 10:21:35.723 Graf[1211:707] call: upload 2012-02-01 10:21:35.729 Graf[1211:707] request byte count: 139647 2012-02-01 10:21:36.246 Graf[1211:707] Stream opened 2012-02-01 10:21:36.247 Graf[1211:707] Has space available 2012-02-01 10:21:37.575 Graf[1211:707] Error: Stream closed while commands are active! 2012-02-01 10:21:37.577 Graf[1211:707] Stream status: 5 2012-02-01 10:21:37.580 Graf[1211:707] KVO: isFinished <Worker: 0x37f6b0> { kind = 1; } 2012-02-01 10:21:37.582 Graf[1211:707] result: (null) 2012-02-01 10:21:37.589 Graf[1211:707] status update: Received text '(null)' for id: (null) 2012-02-01 10:23:22.941 Graf[1211:707] Stream end event

finestructure commented 12 years ago

Looks like DbcConnector's delegate does not handle didDisconnectWithError: and pass this on.

finestructure commented 12 years ago

There's still a timeout edge case:

2012-02-01 16:49:48.364 Graf[1903:707] call: upload 2012-02-01 16:49:48.369 Graf[1903:707] request byte count: 105710 2012-02-01 16:49:48.374 Graf[1903:707] Has space available 2012-02-01 16:49:48.375 Graf[1903:707] Stream opened 2012-02-01 16:50:00.972 Graf[1903:707] Stream end event 2012-02-01 16:50:00.974 Graf[1903:707] Error: Stream closed while commands are active! 2012-02-01 16:50:00.976 Graf[1903:707] Stream status: 5 2012-02-01 16:50:00.978 Graf[1903:707] KVO: isFinished <UploadRequest: 0x13ae90> { kind = 1; } 2012-02-01 16:50:00.989 Graf[1903:707] status update: Timeout while decoding: (null) 2012-02-01 16:50:23.915 Graf[1903:707] Stream end event 2012-02-01 16:50:32.000 Graf[1903:707] Stream end event

Because we don't get back the imageId (need to investigate why), there's no way to change the image back to kIdle.

finestructure commented 12 years ago

It's back again. Need to try and set up a proper test.

finestructure commented 12 years ago

Recipe to reproduce at least one case of indefinite timeout:

  1. Turn network ON
  2. Start app
  3. Turn network OFF
  4. Take picture

=> indefinite timeout. Logs:

2012-02-03 13:54:51.899 Graf[3533:10703] connected to host api.deathbycaptcha.com:8126 2012-02-03 13:54:51.900 Graf[3533:10703] call: login 2012-02-03 13:54:51.900 Graf[3533:10703] request byte count: 64 2012-02-03 13:54:51.901 Graf[3533:10703] Error 2012-02-03 13:54:51.902 Graf[3533:10703] Stream status: 7 2012-02-03 13:54:51.903 Graf[3533:10703] Error info: 2 The operation couldn’t be completed. (kCFErrorDomainCFNetwork error 2.) 2012-02-03 13:54:51.904 Graf[3533:10703] Error while writing data: 2 The operation couldn’t be completed. (kCFErrorDomainCFNetwork error 2.) 2012-02-03 13:54:51.904 Graf[3533:10703] Worker executing upload command 2012-02-03 13:54:51.917 Graf[3533:10703] call: upload 2012-02-03 13:54:51.918 Graf[3533:10703] request byte count: 147070 2012-02-03 13:54:51.919 Graf[3533:10703] Error while writing data: 2 The operation couldn’t be completed. (kCFErrorDomainCFNetwork error 2.) 2012-02-03 13:54:51.926 Graf[3533:10703] Error 2012-02-03 13:54:51.927 Graf[3533:10703] Stream status: 7 2012-02-03 13:54:51.927 Graf[3533:10703] Error info: 2 The operation couldn’t be completed. (kCFErrorDomainCFNetwork error 2.)