jeudi 1 mars 2018

How can I reproduce and test a broken pipe error in golang?

I'm seeing this in my demo site logs for an app I've been working on in golang:

sdv-advwrks_1  | 2018/02/26 09:55:03 Request from '176.32.33.238:58857'
sdv-advwrks_1  | GET / HTTP/1.0
sdv-advwrks_1  | Connection: close
sdv-advwrks_1  | Accept: */*
sdv-advwrks_1  | User-Agent: masscan/1.0 (https://github.com/robertdavidgraham/masscan)
sdv-advwrks_1  | 
sdv-advwrks_1  | 2018/02/26 09:55:03 write tcp 172.19.0.2:8080->176.32.33.238:58857: write: broken pipe

My app is dying with write: broken pipe

I'm using the standard golang net/http server.

I'd like to TDD a fix to this, but I don't know how to reproduce it. It looks like the masscan bot is making a GET, and then moving on leaving an unfinished TCP/IP connection.

1) How do I reproduce this behaviour?

I'm coding on ubuntu linux, and have installed masscan with apt, but haven't figured out how to reproduce the behaviour.

2) Could I create a golang test so that it would become part of my regression test suite?


As an aside I don't yet know how I'm going to fix it, but a failing test would be a good start. In the meantime I'll probably try and get docker-compose to revive it automatically. If my demo is down you'll know why ;-)

Aucun commentaire:

Enregistrer un commentaire