Confusing WAMP serialization error

#1

I’m getting an odd error from all of the RPCs in my application.

The error itself reads as follows:

[Failure instance: Traceback (failure with no frames): <class ‘autobahn.wamp.exception.SerializationError’>: success return value from invoked procedure “pgefadmin.state.query” could not be serialized: WAMP message serialization error: <generator object current_state at 0x000000000A303048> is not JSON serializable]

``

I put some debugger breakpoints in my RPC, but they never triggered. This tells me the procedure is never running, but by saying “return value from invoked procedure” seems to imply that the procedure is running and producing a value.

Does anyone know what might be causing this kind of behavior and / or how I might be able to go about finding the cause?

Code for procedure:

@inlineCallbacks
def onJoin(self, details):
    print('JOINED')

    def current_state(selective=False,
                      user_keys=None,
                      role_keys=None,
                      assign_keys=None,
                      org_keys=None,
                      no_filter=False,
                      details=None):
        dfrd = Deferred()
        defer_id = str(uuid4())
        self.query_results[defer_id] = dfrd
        self.db_queue.put({
                              'func': '_current_state',
                              'kwargs': {
                                            'selective': selective,
                                            'user_keys': user_keys,
                                            'role_keys': role_keys,
                                            'assign_keys': assign_keys,
                                            'org_keys': org_keys,
                                            'no_filter': no_filter,
                                            'details': details
                                        },
                              'query_id': defer_id,
                              'publish': False
                          })
        yield dfrd
        if 'error' in dfrd.result:
            raise dfrd.result['error']
        del self.query_results[defer_id]
        returnValue(dfrd.result)

    yield self.register(current_state,
                        u'pgefadmin.state.query',
                        RegisterOptions(details_arg='details'))

``

There are other threads running which pull from db_queue, run some database operations through sqlalchemy, and then use reactor.callFromThread to give the results back to the Deferred.

0 Likes

#2

I faced same issue,
I traced it to the date type column. Looks like the date field cannot be serialized by wamp.

Not sure if there are other types that cannot be serialized.

Hope it helps!

Regards,

Amit

···

On Friday, August 25, 2017 at 1:11:45 AM UTC+5:30, Michael Plante wrote:

I’m getting an odd error from all of the RPCs in my application.

The error itself reads as follows:

[Failure instance: Traceback (failure with no frames): <class ‘autobahn.wamp.exception.SerializationError’>: success return value from invoked procedure “pgefadmin.state.query” could not be serialized: WAMP message serialization error: <generator object current_state at 0x000000000A303048> is not JSON serializable]

``

I put some debugger breakpoints in my RPC, but they never triggered. This tells me the procedure is never running, but by saying “return value from invoked procedure” seems to imply that the procedure is running and producing a value.

Does anyone know what might be causing this kind of behavior and / or how I might be able to go about finding the cause?

Code for procedure:

@inlineCallbacks
def onJoin(self, details):
    print('JOINED')

    def current_state(selective=False,
                      user_keys=None,
                      role_keys=None,
                      assign_keys=None,
                      org_keys=None,
                      no_filter=False,
                      details=None):
        dfrd = Deferred()
        defer_id = str(uuid4())
        self.query_results[defer_id] = dfrd
        self.db_queue.put({
                              'func': '_current_state',
                              'kwargs': {
                                            'selective': selective,
                                            'user_keys': user_keys,
                                            'role_keys': role_keys,
                                            'assign_keys': assign_keys,
                                            'org_keys': org_keys,
                                            'no_filter': no_filter,
                                            'details': details
                                        },
                              'query_id': defer_id,
                              'publish': False
                          })
        yield dfrd
        if 'error' in dfrd.result:
            raise dfrd.result['error']
        del self.query_results[defer_id]
        returnValue(dfrd.result)

    yield self.register(current_state,
                        u'pgefadmin.state.query',
                        RegisterOptions(details_arg='details'))

``

There are other threads running which pull from db_queue, run some database operations through sqlalchemy, and then use reactor.callFromThread to give the results back to the Deferred.

0 Likes