skx / overseer

A golang-based remote protocol tester for testing sites & service availability

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Panic in worker

skx opened this issue · comments

If using a distributed setup, i.e. redis, then the following is enough to crash a worker:

    $ overseer enqeueu ./pop.txt
    $ overseer worker -verbose

Where pop.txt contains:

    pop.gmx.com must run pop3
    pop.gmx.com must run pop3s insecure

This is a fun one to diagnose, it turns out that run_test_string is invoked to parse the output from redis - which is breaking state - and the regexp used in that parsing is [a-z]. So pop3 doesn't match, instead the system wants to invoke the pop handler. We've recently decided to trust the parser, such that run_test looks up the handler and invokes it:

tmp := protocols.ProtocolHandler(test_type)
tmp.SetLine(input)

So this bug comes from two things:

  • Parsing the input outside the parser - and not handling numbers.
  • Not checking for validity.

Suggest we update the parser package to export:

  • New()
  • ParseFile()
  • ParseLine()

Then the run_test_string can go away, and the worker can use ParseLine. All existing users of Parse will be updated to use ParseFile instead.

This will cleanup our API, avoid breaking state - by parsing outside parser/ - and allow the crash to be resolved.