Skip to content

Released gor1.3 forwards the same request twice on Linux #989

@anatoly71

Description

@anatoly71

Hello, I am using macbook, gor1.3.

I deploy two docker containers (linux) exposing an http endpoint each.
They are started with docker-compose so that they can communicate with each other being on the same docker network.

"mock1" linux container:

  • http endpont with port 9003
  • gor1.3 started with command ./gor1.3 -verbose 3 -input-raw :9003 -output-http http://mock2:9004

"mock2" linux container:

  • http endpont with port 9004

I execute tcpdump on the both containers to see requests.

Scenario:: mac host -> linux mock1 (goreplay) -> linux mock2.
I send a request to linux container mock1 (goreplay here) using mapped port 9093, and I expect the request forwarded to linux container mock2. The actual outcome TWO requests forwarded.

on my workstation I execute
curl -v "http://localhost:9093/some/path" -H "accept: application/json"

mock1
tcpdump records ONE incoming request but goreplay reports TWO incoming requests

bash-4.3#tcpdump -Avvs0 -i eth0 'dst port 9003 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)'
tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 262144 bytes
11:36:00.901910 IP (tos 0x0, ttl 64, id 61123, offset 0, flags [DF], proto TCP (6), length 156)
172.24.0.1.57306 > 20b83084ad91.9003: Flags [P.], cksum 0x58c2 (incorrect -> 0x4cac), seq 1525591779:1525591883, ack 70000080, win 502, options [nop,nop,TS val 1146716091 ecr 3110618404], length 104
E.....@.@..d..........#+Z....,......X......
DY...hE$GET /some/path HTTP/1.1
Host: localhost:9093
User-Agent: curl/7.64.1
accept: application/json

goreplay reports TWO incoming requests (same meta data in the debug output)

bash-4.3# ./gor1.3 -verbose 3 -input-raw :9003 -output-http http://mock2:9004
[DEBUG][elapsed 91.0109ms]: Intercepting traffic from: :[9003]
2021/08/10 11:35:27 [PPID 42 and PID 122] Version:1.3.0
[DEBUG][elapsed 34.7126803s]: [EMITTER] input: 1 dfda232bac180001042c1dd0 1628595360901910500 0 from: Intercepting traffic from: :[9003]
[DEBUG][elapsed 1.6367ms]: [EMITTER] input: 1 dfda232bac180001042c1dd0 1628595360901910500 0 from: Intercepting traffic from: :[9003]

mock2
TWO requests received

bash-4.3# tcpdump -Avvs0 -i eth0 'dst port 9004 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)'
tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 262144 bytes
11:36:02.527683 IP (tos 0x0, ttl 64, id 50761, offset 0, flags [DF], proto TCP (6), length 175)
scripts_mock1_1.scripts_default.41406 > b9561d25d337.9004: Flags [P.], cksum 0x58d7 (incorrect -> 0x8750), seq 4181280619:4181280742, ack 3794026077, win 502, options [nop,nop,TS val 724414948 ecr 703821815], length 123
E....I@.@.............#,.9Gk.$>]....X......
+-..).w.GET /ftaas/v1/info HTTP/1.1
Host: mock2:9004
User-Agent: curl/7.64.1
Accept: application/json
Accept-Encoding: gzip

11:36:02.530773 IP (tos 0x0, ttl 64, id 46863, offset 0, flags [DF], proto TCP (6), length 175)
scripts_mock1_1.scripts_default.41408 > b9561d25d337.9004: Flags [P.], cksum 0x58d7 (incorrect -> 0x3dc0), seq 1256581563:1256581686, ack 2418861540, win 502, options [nop,nop,TS val 724414951 ecr 703821815], length 123
E.....@.@.+...........#,J....,......X......
+-..).w.GET /ftaas/v1/info HTTP/1.1
Host: mock2:9004
User-Agent: curl/7.64.1
Accept: application/json
Accept-Encoding: gzip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions