[FX-178] Hang in FIXReader::sockRead - Fix8 JIRA

Hang in FIXReader::sockRead

Description

Fix8 configure options:
--with-maxmsglen=16384 --with-maxfldlen=8192

An application works fine with fix8-0.9.6 but does not work correctly with fix8-1.0.0. A logout is triggered, log file extract below:
0000003 out 2014-01-17 05:22:59.904021473 Connection successful
0000004 out 2014-01-17 05:22:59.904107855 Session connected
0000005 out 2014-01-17 05:22:59.908471896 Client setting heartbeat interval to 30
0000006 out 2014-01-17 05:22:59.908625429 Heartbeat interval is 30
0000007 out 2014-01-17 05:23:37.125441249 Have not received anything from remote for 37 secs. Sending test request
0000008 out 2014-01-17 05:23:38.133506393 Remote has ignored my test request. Aborting session...

It appears that the FixReader is successfully reads Logon and UserRequest messages but hangs when reading TradingSessionStatus message (length 14326 bytes) and therefore is unable to read any further incoming messages.

Substituting the function definition for FIXReader::sockRead from fix8-0.9.6 into fix8-1.0.0 fixes the above issue.

The hang happens at:
rdsz = _sock->receiveBytes(_read_buffer_wptr, maxremaining);

The values of the variables at the time of hang:
maxremaining = 16384

At beginning of each iteration, value of remaining:
initial: 14326
iteration 1:12866
iteration 2:9946
iteration 3:8486
iteration 4:4106
iteration 5:2895
iteration 6:2797
iteration 7:2690
[Hang here at rdsz = _sock->receiveBytes(_read_buffer_wptr, maxremaining);]

Substituting remaining instead of maxremaining also fixes the issue,i.e.:
rdsz = _sock->receiveBytes(_read_buffer_wptr, remaining);

Environment

Linux, Mac OS X

Status

Assignee

Sergey Sedreev

Reporter

Venkat

Labels

None

Branch

dev

Products

None

Fix versions

Affects versions

1.0.0
0.10.0

Priority

Major