#4391 Less log noise for empty or invalid requests
Merged a month ago by tkopecek. Opened a month ago by mikem.

file modified
+11 -1
@@ -239,6 +239,11 @@ 

              if maxlen and rlen > maxlen:

                  raise koji.GenericError('Request too long')

              parser.feed(chunk)

+         if rlen == 0:

+             # blank posts are unfortunately a common client mistake

+             # make them less noisy

+             self.logger.debug('Empty request')

+             raise BadRequest('Empty request')

          parser.close()

          return unmarshaller.close(), unmarshaller.getmethodname()

  
@@ -296,7 +301,12 @@ 

          return kojihub.handle_upload(environ)

  

      def handle_rpc(self, environ):

-         params, method = self._read_request(environ['wsgi.input'])

+         try:

+             params, method = self._read_request(environ['wsgi.input'])

+         except Exception as e:

+             # only log full trace in debug stream

+             self.logger.debug("Error reading request", exc_info=True)

+             raise BadRequest('Invalid request: %s' % e)

          return self._dispatch(method, params)

  

      def check_session(self):

I see a lot of noise in the hub logs from malformed requests. This relegates such output to the debug log.

It also returns a 400 error rather than a fault. If the client isn't sending us a valid xmlrpc request, it doesn't make sense to send an xmlrpc reply.

Metadata Update from @tkopecek:
- Pull-request tagged with: testing-basic

a month ago

Metadata Update from @mfilip:
- Pull-request tagged with: testing-done

a month ago

Commit 40e6286 fixes this pull-request

Pull-Request has been merged by tkopecek

a month ago