Skip to content

WRITE_COMPLETE event in http server open causes traffic server to abort #1930

Closed

Description

@vmamidi

Stack trace :
ink_abort(char const*, ...)
HttpSM::state_http_server_open(int, void*)
HttpSM::main_handler(int, void*)
write_to_net_io(NetHandler*, UnixNetVConnection*, EThread*)
NetHandler::mainNetEvent(int, Event*)
EThread::execute()

and corresponding error messages:
traffic_server[33593]: {0x2aaab6d0c700} ERROR: [HttpSM::state_http_server_open] Unknown event: 103
traffic_server[33593]: FATAL: HttpSM.cc:1798: failed assertion 0

We are seeing this in 7.0.0

Activity

  1. scw00 commented on May 17, 2017

    @scw00
    Member

    Print history in HttpSM

  2. vmamidi commented on May 18, 2017

    @vmamidi
    ContributorAuthor

    i dont have any more information

  3. scw00 commented on May 18, 2017

    @scw00
    Member

    :(.....sad!!

  4. bryancall commented on May 23, 2017

    @bryancall
    Contributor

    @vmamidi What version is this for?

  5. vmamidi commented on May 23, 2017

    @vmamidi
    ContributorAuthor

    we are seeing this on 7.0.0

  6. bryancall commented on May 24, 2017

    @bryancall
    Contributor

    @vmamidi Can you post a better backtrace with line numbers in the code? bt full would be great!

  7. vmamidi commented on Jun 1, 2017

    @vmamidi
    ContributorAuthor

    @scw00 I was able to get the history. Here is the history for ATS on 7.1.x branch.
    [0] =
    fileline = 0x55a3621f7912
    *0x55a3621f7912 = string(0x55a3621f7912, [HttpSM.cc:630])
    event = 100
    reentrancy = 2
    [1] =
    fileline = 0x55a3621f7d6d
    *0x55a3621f7d6d = string(0x55a3621f7d6d, [HttpSM.cc:1339])
    event = 60000
    reentrancy = 3
    [2] =
    fileline = 0x55a3621f7d98
    *0x55a3621f7d98 = string(0x55a3621f7d98, [HttpSM.cc:1379])
    event = 60000
    reentrancy = 3
    [3] =
    fileline = 0x55a3621f7d6d
    *0x55a3621f7d6d = string(0x55a3621f7d6d, [HttpSM.cc:1339])
    event = 60000
    reentrancy = 4
    [4] =
    fileline = 0x55a3621f7d98
    *0x55a3621f7d98 = string(0x55a3621f7d98, [HttpSM.cc:1379])
    event = 60000
    reentrancy = 4
    [5] =
    fileline = 0x55a3621f7d6d
    *0x55a3621f7d6d = string(0x55a3621f7d6d, [HttpSM.cc:1339])
    event = 60000
    reentrancy = 5
    [6] =
    fileline = 0x55a3621f7d98
    *0x55a3621f7d98 = string(0x55a3621f7d98, [HttpSM.cc:1379])
    event = 60000
    reentrancy = 5
    [7] =
    fileline = 0x55a3621f7d6d
    *0x55a3621f7d6d = string(0x55a3621f7d6d, [HttpSM.cc:1339])
    event = 60000
    reentrancy = 6
    [8] =
    fileline = 0x55a3621f7d98
    *0x55a3621f7d98 = string(0x55a3621f7d98, [HttpSM.cc:1379])
    event = 60000
    reentrancy = 6
    [9] =
    fileline = 0x55a3621f7d6d
    *0x55a3621f7d6d = string(0x55a3621f7d6d, [HttpSM.cc:1339])
    event = 60000
    reentrancy = 7
    [10] =
    fileline = 0x55a3621f7d98
    *0x55a3621f7d98 = string(0x55a3621f7d98, [HttpSM.cc:1379])
    event = 60000
    reentrancy = 7
    [11] =
    fileline = 0x55a3621fa4bc
    *0x55a3621fa4bc = string(0x55a3621fa4bc, [HttpSM.cc:7373])
    event = 65535
    reentrancy = 7
    [12] =
    fileline = 0x55a3621f2ebd
    *0x55a3621f2ebd = string(0x55a3621f2ebd, [HttpCacheSM.cc:118])
    event = 1103
    reentrancy = -1
    [13] =
    fileline = 0x55a3621f84d6
    *0x55a3621f84d6 = string(0x55a3621f84d6, [HttpSM.cc:2577])
    event = 1103
    reentrancy = 8
    [14] =
    fileline = 0x55a3621f7d6d
    *0x55a3621f7d6d = string(0x55a3621f7d6d, [HttpSM.cc:1339])
    event = 60000
    reentrancy = 9
    [15] =
    fileline = 0x55a3621f7d98
    *0x55a3621f7d98 = string(0x55a3621f7d98, [HttpSM.cc:1379])
    event = 60000
    reentrancy = 9
    [16] =
    fileline = 0x55a3621f7d6d
    *0x55a3621f7d6d = string(0x55a3621f7d6d, [HttpSM.cc:1339])
    event = 60000
    reentrancy = 10
    [17] =
    fileline = 0x55a3621f7d98
    *0x55a3621f7d98 = string(0x55a3621f7d98, [HttpSM.cc:1379])
    event = 60000
    reentrancy = 10
    [18] =
    fileline = 0x55a3621fa49e
    *0x55a3621fa49e = string(0x55a3621fa49e, [HttpSM.cc:7359])
    event = 65535
    reentrancy = 10
    [19] =
    fileline = 0x55a3621fa4e9
    *0x55a3621fa4e9 = string(0x55a3621fa4e9, [HttpSM.cc:7488])
    event = 65535
    reentrancy = 10
    [20] =
    fileline = 0x55a3621f2f73
    *0x55a3621f2f73 = string(0x55a3621f2f73, [HttpCacheSM.cc:177])
    event = 1108
    reentrancy = -1
    [21] =
    fileline = 0x55a3621f8429
    *0x55a3621f8429 = string(0x55a3621f8429, [HttpSM.cc:2458])
    event = 1108
    reentrancy = 11
    [22] =
    fileline = 0x55a3621fa4da
    *0x55a3621fa4da = string(0x55a3621fa4da, [HttpSM.cc:7386])
    event = 65535
    reentrancy = 11
    [23] =
    fileline = 0x55a3621f9263
    *0x55a3621f9263 = string(0x55a3621f9263, [HttpSM.cc:4578])
    event = 0
    reentrancy = 7
    [24] =
    fileline = 0x55a3621f8055
    *0x55a3621f8055 = string(0x55a3621f8055, [HttpSM.cc:1980])
    event = 103
    reentrancy = 1
    [25] =
    fileline = 0x55a3621f7fd2
    *0x55a3621f7fd2 = string(0x55a3621f7fd2, [HttpSM.cc:1810])
    event = 104
    reentrancy = 1
    [26] =
    fileline = 0x55a3621f96cc
    *0x55a3621f96cc = string(0x55a3621f96cc, [HttpSM.cc:5485])
    event = 104
    reentrancy = 1
    [27] =
    fileline = 0x55a3621fa4da
    *0x55a3621fa4da = string(0x55a3621fa4da, [HttpSM.cc:7386])
    event = 65535
    reentrancy = 1
    [28] =
    fileline = 0x55a3621f8055
    *0x55a3621f8055 = string(0x55a3621f8055, [HttpSM.cc:1980])
    event = 103
    reentrancy = 1
    [29] =
    fileline = 0x55a3621f7fd2
    *0x55a3621f7fd2 = string(0x55a3621f7fd2, [HttpSM.cc:1810])
    event = 104
    reentrancy = 1
    [30] =
    fileline = 0x55a3621f96cc
    *0x55a3621f96cc = string(0x55a3621f96cc, [HttpSM.cc:5485])
    event = 104
    reentrancy = 1
    [31] =
    fileline = 0x55a3621fa49e
    *0x55a3621fa49e = string(0x55a3621fa49e, [HttpSM.cc:7359])
    event = 65535
    reentrancy = 1
    [32] =
    fileline = 0x55a3621f7fd2
    *0x55a3621f7fd2 = string(0x55a3621f7fd2, [HttpSM.cc:1810])
    event = 3
    reentrancy = 1
    [33] =
    fileline = 0x55a3621f96cc
    *0x55a3621f96cc = string(0x55a3621f96cc, [HttpSM.cc:5485])
    event = 3
    reentrancy = 1
    [34] =
    fileline = 0x55a3621fa4da
    *0x55a3621fa4da = string(0x55a3621fa4da, [HttpSM.cc:7386])
    event = 65535
    reentrancy = 1
    [35] =
    fileline = 0x55a3621f7ef5
    *0x55a3621f7ef5 = string(0x55a3621f7ef5, [HttpSM.cc:1716])
    event = 200
    reentrancy = 2
    [36] =
    fileline = 0x55a3621f8055
    *0x55a3621f8055 = string(0x55a3621f8055, [HttpSM.cc:1980])
    event = 103
    reentrancy = 1
    [37] =
    fileline = 0x55a3621f7ef5
    *0x55a3621f7ef5 = string(0x55a3621f7ef5, [HttpSM.cc:1716])
    event = 500
    reentrancy = 1

  8. scw00 commented on Jun 1, 2017

    @scw00
    Member

    great!

  9. scw00 commented on Jun 1, 2017

    @scw00
    Member

    Ok I got it.

    The reason is that the HttpSM::state_send_server_request_header may receive the ERROR event when read side down. Then ats retry another server without cleaning the write side.

    It may reference to #1629 and #1559 .

  10. scw00 commented on Jun 1, 2017

    @scw00
    Member
  11. vmamidi commented on Jun 1, 2017

    @vmamidi
    ContributorAuthor

    looks like HttpSM is receiving VC_EVENT_ERROR and also WRITE_COMPLETE event after EOS.

  12. oknet commented on Jun 1, 2017

    @oknet
    Member

    ATS do a hostdb lookup to retry the next ip by round robin.

    [31] =
    fileline = 0x55a3621fa49e
    *0x55a3621fa49e = string(0x55a3621fa49e, [HttpSM.cc:7359])
    event = 65535
    reentrancy = 1
    

    The hostdb callback at [37]

    [37] =
    fileline = 0x55a3621f7ef5
    *0x55a3621f7ef5 = string(0x55a3621f7ef5, [HttpSM.cc:1716])
    event = 500
    reentrancy = 1
    

    I don't know the reason why [32] shows in the history, it should blocked by pending_action.

    Also, I noticed :

    traffic_server[33593]: {0x2aaab6d0c700} ERROR: [HttpSM::state_http_server_open] Unknown event: 103
    

    The event is changed from 500 to 103. What is that means ?
    May be one callback to HttpSM without get the mutex lock first ? HostDB bug ?

  13. oknet commented on Jun 1, 2017

    @oknet
    Member

    @scw00 I think we should cleanup server_entry at HttpSM.cc:7359, just do the same thing at HttpSM.cc:7386.

  14. 22 remaining items

  15. scw00 commented on Jun 5, 2017

    @scw00
    Member

    In the second history, we can see that client post timeout ([27]) and we send the 408 to client. Then server side will receive timeout and retry [28].

    The problem is we did not close the vc directly.

    That was fixed in 8.0.x

  16. oknet commented on Jun 5, 2017

    @oknet
    Member

    @vmamidi please try to fix the 2nd scenario by backport #1583 .

  17. vmamidi commented on Jun 5, 2017

    @vmamidi
    ContributorAuthor

    @oknet @scw00 @zwoop I am okay with having patches for each of the histories that we have on this issue but I am worried that state machine can receive events for past states that too because of something we did in #947 as pointed out by @oknet. As of now, I don't think state machine is robust enough to handle events for past states but if that is expected behavior we should make sure that HttpSM is robust enough to handle that.

  18. vmamidi commented on Jun 5, 2017

    @vmamidi
    ContributorAuthor

    @oknet @scw00 @zwoop @bryancall @SolidWallOfCode I understand the scenario mentioned in #947 but, state machine now can receive unexpected events. Now, we have to either fix the state machine with the new expectation or revert #947 and come up with a different solution which does not break the expectation and fixes the mentioned scenario. I personally do not think the current approach of leaving the state machine in not so robust state is a good idea.

  19. zwoop commented on Jun 5, 2017

    @zwoop
    Contributor

    This might be worthwhile to take to the mailing list (dev@trafficserver). I'm ok either way, but I think it'd be better discussed / decided on the mailing list (I'm not sure who, if any, actually read these Issue comments :-).

  20. added this to the 7.1.0 milestone on Jun 6, 2017
  21. zwoop commented on Jun 7, 2017

    @zwoop
    Contributor

    Everyone: I think we're to the point now of considering backing out #947. Is this agreeable by everyone?

  22. scw00 commented on Jun 8, 2017

    @scw00
    Member

    Agree!

  23. oknet commented on Jun 8, 2017

    @oknet
    Member

    +1

  24. added a commit that references this issue on Jun 8, 2017
  25. added a commit that references this issue on Jun 8, 2017
  26. removed this from the 7.1.0 milestone on Jun 23, 2017
  27. zwoop commented on Jun 23, 2017

    @zwoop
    Contributor

    I'm removing the 7.1.0 Milestone from this Issue, but keeping this open for now as there's valuable discussions here.

  28. bryancall commented on May 22, 2019

    @bryancall
    Contributor

    If this is still an issue please reopen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions