Skip to content

setting the serialization for loopback and in-process sockets #361

@bangxiangyong

Description

@bangxiangyong

in the run function of agent, the serializer for sockets has been hardcoded to be 'pickle', shouldn't this be set to the serializer of the individual agents, or the global serializer in osbrain.config?

what i find is that 'pickle' was still used to serialize the parameters of passed functions, although i specifically set to use other serializers.

therefore, changing the global osbrain.config['SERIALIZER'] doesn't change this behaviour either

snippet in agent.py

    @Pyro4.oneway
    def run(self):
        """
        Start the main loop.
        """
        # A loopback socket where, for example, timers are processed
        self.bind(
            'REP',
            alias='loopback',
            addr='loopback',
            handler=self._handle_loopback,
            transport='inproc',
            serializer='pickle',
        )

        # This in-process socket handles safe access to
        # memory from other threads (i.e. when using Pyro proxies).
        self.bind(
            'REP',
            alias='_loopback_safe',
            addr='_loopback_safe',
            handler=self._handle_loopback_safe,
            transport='inproc',
            serializer='pickle',
        )

i believe the fix should be to set serializer=self._serializer instead of serializer='pickle'

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions