crossbario / autobahn-testsuite

Autobahn WebSocket protocol testsuite

Home Page:https://crossbar.io/autobahn/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

exceptions.AttributeError: 'NoneType' object has no attribute 'strip'

cluick opened this issue · comments

Hi Folks,
I´m trying to run the Autobahn test suite in "fuzzingclient" mode against a custom websocket server to discover connection and compatibility issues in the custom websocket implementation. The http traffic runs over two proxy servers (Traefik, Nginx).
I execute the test suite with the following command line:
wstest -d -m fuzzingclient -o report.html | tee output.txt
The problem is that the test never finishes. However, the following exception is dumped to the console:

Traceback (most recent call last):
          File "/home/cluick/wstest/local/lib/python2.7/site-packages/autobahntestsuite/wstest.py", line 346, in run
            start(options, spec)
          File "/home/cluick/wstest/local/lib/python2.7/site-packages/autobahntestsuite/wstest.py", line 280, in start
            reactor.run()
          File "/home/cluick/wstest/local/lib/python2.7/site-packages/twisted/internet/base.py", line 1243, in run
            self.mainLoop()
          File "/home/cluick/wstest/local/lib/python2.7/site-packages/twisted/internet/base.py", line 1252, in mainLoop
            self.runUntilCurrent()
        --- <exception caught here> ---
          File "/home/cluick/wstest/local/lib/python2.7/site-packages/twisted/internet/base.py", line 878, in runUntilCurrent
            call.func(*call.args, **call.kw)
          File "/home/cluick/wstest/local/lib/python2.7/site-packages/twisted/internet/tcp.py", line 479, in connectionLost
            self.connector.connectionLost(reason)
          File "/home/cluick/wstest/local/lib/python2.7/site-packages/twisted/internet/base.py", line 1136, in connectionLost
            self.factory.clientConnectionLost(self, reason)
          File "/home/cluick/wstest/local/lib/python2.7/site-packages/twisted/protocols/policies.py", line 167, in clientConnectionLost
            self.wrappedFactory.clientConnectionLost(connector, reason)
          File "/home/cluick/wstest/local/lib/python2.7/site-packages/autobahntestsuite/fuzzing.py", line 1292, in clientConnectionLost
            self.createReports()
          File "/home/cluick/wstest/local/lib/python2.7/site-packages/autobahntestsuite/fuzzing.py", line 469, in createReports
            self.createMasterReportHTML(self.outdir)
          File "/home/cluick/wstest/local/lib/python2.7/site-packages/autobahntestsuite/fuzzing.py", line 670, in createMasterReportHTML
            agent_case_report_file = self.makeAgentCaseReportFilename(agentId, caseId, ext = 'html')
          File "/home/cluick/wstest/local/lib/python2.7/site-packages/autobahntestsuite/fuzzing.py", line 498, in makeAgentCaseReportFilename
            return self.cleanForFilename(agentId) + "_case_" + c + "." + ext
          File "/home/cluick/wstest/local/lib/python2.7/site-packages/autobahntestsuite/fuzzing.py", line 487, in cleanForFilename
            s0 = ''.join([c if c in "abcdefghjiklmnopqrstuvwxyz0123456789" else " " for c in str.strip().lower()])
        exceptions.AttributeError: 'NoneType' object has no attribute 'strip'

The complete test directory including the console output can be found in the following ZIP file:
wstest.zip

I´m using wstest version 17.5.0.

Can you please tell me what is going wrong here?

Thank you & best regards,
Christof Luick.

Sorry - I reported the "twisted" version. The output of wstest -a is:

Autobahn 0.10.9
AutobahnTestSuite 0.7.6

I'm hitting this same error, both when I try to run locally on Ubuntu 16.04 or using the crossbar-docker/autobahn-testsuite container. My versions are the same:

Autobahn 0.10.9
AutobahnTestSuite 0.7.6

I am not an Autobahn Testsuite expert but I was getting the exact same error.

Sneak looking into the autobahn internal files a little bit I found out my server I was not "upgrading" the HTTP connection properly. While the upgrading process, the server was not responding properly and it was getting an "None" User-Agent (the header was not even present).

In short, double check your upgrading process and make sure it is working.

@jamillosantos Hrmmmm interesting. So the user-agent header must be present in the response to an upgrade request? That seems a but strange to me.

Well, as I told you, I am not an expert.

I know that Autobahn uses the user agent information on the header of the report table and It was what was crashing the autobahn in my specific case.

I just ran into this issue with the latest version (AutobahnTestSuite 0.8.2, Autobahn 0.10.9).

I seem to remember an older version of autobahn-testsuite using the "server" header as the agent name by default, but it doesn't seem to be doing that anymore. As far as I can tell, it would be incorrect to send the "user-agent" header from the server.

I did, however, find that you can add an "agent" key for the server item under "servers" in fuzzingclient.json and the test will generate reports without issue. The agent string can be anything.

Example:
"servers": [ { "agent": "serverundertest", "url": "ws://127.0.0.1" } ],

just a quick comment (if I remember correctly .. long ago;), maybe that's useful:

  • the testsuite needs to have a name for the testee to generate reports
  • "User-Agent": a testee server can set this header which is then used eg when generating reports
  • "agent": alternatively, the name to be used when generating reports can be hard coded from the fuzzing client config (which needs to address the tested server anyways)