[TIMOB-25676] iOS: HTTPClient unit-test sometimes fails because of incorrect states
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Cannot Reproduce |
Resolution Date | 2018-02-15T13:44:57.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | iOS |
Labels | n/a |
Reporter | Hans Knöchel |
Assignee | Hans Knöchel |
Created | 2018-01-16T08:41:15.000+0000 |
Updated | 2018-02-15T13:45:10.000+0000 |
Description
The following test-case sometimes fails because the
onreadystate
event fires before the ondatastream
one. There are also cases where the orreadystate
fires one state twice because the states are lost as a result of a race condition when sending out the events.
The proposed fix (working 20/20 times so far) is to ensure we are firing events to the client serial (blocking) on the main-thread. This ensures all state events get queued correctly and fixes the above issues.
Before:
2018-01-16 09:40:35.286 Titanium[4965:119750] [INFO] 1
2018-01-16 09:40:35.288 Titanium[4965:119750] [INFO] 3
2018-01-16 09:40:35.288 Titanium[4965:119750] [INFO] 3
2018-01-16 09:40:35.289 Titanium[4965:119750] [INFO] 4
2018-01-16 09:40:35.289 Titanium[4965:119750] [INFO] DONE
After:
2018-01-16 09:40:35.286 Titanium[4965:119750] [INFO] 1
2018-01-16 09:40:35.288 Titanium[4965:119750] [INFO] 2
2018-01-16 09:40:35.288 Titanium[4965:119750] [INFO] 3
2018-01-16 09:40:35.289 Titanium[4965:119750] [INFO] 4
2018-01-16 09:40:35.289 Titanium[4965:119750] [INFO] DONE
PR (master): https://github.com/appcelerator/titanium_mobile/pull/9737 PR (7_0_X): https://github.com/appcelerator/titanium_mobile/pull/9738
Not an issue anymore