Skip to content

rawfile_json returner doesn't work in any context #39959

Closed as not planned
Closed as not planned

Description

@NickDubelman

I am trying to configure my master_job_cache to use a rawfile_json as its returner and am observing that not only does this not work (causes exceptions to be thrown on every command), but even when I disable the master_job_cache and just try to use --return rawfile_json, no file is created. I have checked the default rawfile_json.filename location and changed this manually and neither files exist. There isn't much documentation on this topic so I have no idea if I'm setting it up correctly.

Activity

  1. changed the title [-]rawfile_json returned doesn't work in any context[/-] [+]rawfile_json returner doesn't work in any context[/+] on Mar 10, 2017
  2. Ch3LL commented on Mar 10, 2017

    @Ch3LL
    Contributor

    How do yo have everything configured. I tested this really quick by adding rawfile_json.filename: /var/log/salt/events to the minion and running salt '*' test.version --return rawfile_json and it showed up in the file. Can you share all your settings?

  3. added
    needs-more-info
    on Mar 10, 2017
  4. added this to the Blocked milestone on Mar 10, 2017
  5. NickDubelman commented on Mar 13, 2017

    @NickDubelman
    Author

    Okay I have been able to get the returner to work as you showed, however I am now trying to use this as a master_job_cache and have not been able to get it to work. Should this returner be usable as a master_job_cache?

    These are the errors I see:

    ~ @dist100.mfgdev> sudo salt \* test.ping
    [CRITICAL] Could not deserialize msgpack message.This often happens when trying to read a file not in binary modeTo see message payload, enable debug logging and retry. Exception: unpack(b) received extra data.
    [ERROR   ] Uncaught exception, closing connection.
    Traceback (most recent call last):
      File "/usr/lib64/python2.7/site-packages/zmq/eventloop/zmqstream.py", line 407, in _run_callback
        callback(*args, **kwargs)
      File "/usr/lib64/python2.7/site-packages/tornado/stack_context.py", line 275, in null_wrapper
        return fn(*args, **kwargs)
      File "/usr/lib/python2.7/site-packages/salt/transport/zeromq.py", line 964, in mark_future
        data = self.serial.loads(msg[0])
      File "/usr/lib/python2.7/site-packages/salt/payload.py", line 137, in loads
        ret = msgpack.loads(msg, use_list=True, encoding=encoding)
      File "msgpack/_unpacker.pyx", line 142, in msgpack._unpacker.unpackb (msgpack/_unpacker.cpp:142)
    ExtraData: unpack(b) received extra data.
    [ERROR   ] Uncaught exception, closing connection.
    Traceback (most recent call last):
      File "/usr/lib64/python2.7/site-packages/zmq/eventloop/zmqstream.py", line 433, in _handle_events
        self._handle_recv()
      File "/usr/lib64/python2.7/site-packages/zmq/eventloop/zmqstream.py", line 465, in _handle_recv
        self._run_callback(callback, msg)
      File "/usr/lib64/python2.7/site-packages/zmq/eventloop/zmqstream.py", line 407, in _run_callback
        callback(*args, **kwargs)
      File "/usr/lib64/python2.7/site-packages/tornado/stack_context.py", line 275, in null_wrapper
        return fn(*args, **kwargs)
      File "/usr/lib/python2.7/site-packages/salt/transport/zeromq.py", line 964, in mark_future
        data = self.serial.loads(msg[0])
      File "/usr/lib/python2.7/site-packages/salt/payload.py", line 137, in loads
        ret = msgpack.loads(msg, use_list=True, encoding=encoding)
      File "msgpack/_unpacker.pyx", line 142, in msgpack._unpacker.unpackb (msgpack/_unpacker.cpp:142)
    ExtraData: unpack(b) received extra data.
    [ERROR   ] Exception in callback None
    Traceback (most recent call last):
      File "/usr/lib64/python2.7/site-packages/tornado/ioloop.py", line 866, in start
        handler_func(fd_obj, events)
      File "/usr/lib64/python2.7/site-packages/tornado/stack_context.py", line 275, in null_wrapper
        return fn(*args, **kwargs)
      File "/usr/lib64/python2.7/site-packages/zmq/eventloop/zmqstream.py", line 433, in _handle_events
        self._handle_recv()
      File "/usr/lib64/python2.7/site-packages/zmq/eventloop/zmqstream.py", line 465, in _handle_recv
        self._run_callback(callback, msg)
      File "/usr/lib64/python2.7/site-packages/zmq/eventloop/zmqstream.py", line 407, in _run_callback
        callback(*args, **kwargs)
      File "/usr/lib64/python2.7/site-packages/tornado/stack_context.py", line 275, in null_wrapper
        return fn(*args, **kwargs)
      File "/usr/lib/python2.7/site-packages/salt/transport/zeromq.py", line 964, in mark_future
        data = self.serial.loads(msg[0])
      File "/usr/lib/python2.7/site-packages/salt/payload.py", line 137, in loads
        ret = msgpack.loads(msg, use_list=True, encoding=encoding)
      File "msgpack/_unpacker.pyx", line 142, in msgpack._unpacker.unpackb (msgpack/_unpacker.cpp:142)
    ExtraData: unpack(b) received extra data.
    Salt request timed out. The master is not responding. If this error persists after verifying the master is up, worker_threads may need to be increased.
    
  6. Ch3LL commented on Mar 14, 2017

    @Ch3LL
    Contributor

    If you look at the docs here
    you can see a returner requires a couple of additional functions in order to support the master job cache. I do not see these functions in the rawfile_json returner. So i'll approve this as a feature request to get that added for master job cache support.

    there is another issue though you shouldn't be getting that ExtraData: unpack(b) received extra data. error. We would want to have a more useful error. What version of salt are you using. This was suppose to start getting caught here: #37503

  7. added
    Feature
    RIoT
    and removed
    needs-more-info
    on Mar 14, 2017
  8. marbx commented on Apr 16, 2017

    @marbx
    Contributor

    Hello @Ch3LL,
    I feel unfortunate to have hit exactly the same problem.

    Documentation on rawfile_json explicitly says

    • "Write event return data to a file on the master" and
    • "Add the following to the minion or master configuration file"

    that's why @NickDubelman and I tried to, well, "write event return data to a file on the master" with rawfile_json.

    The rawfile_json documentation should be corrected, until this feature request (or maybe bug fix) is implemented.
    Adding master_job_cache: rawfile_json to the master config provokes the stacktraces shown here.

    What are our options to write event return data to a file on the master?

    Like rawfile_json, the redis returner example only has a returner() function.
    Does redis work on the Master?
    That would be nice, because redis is in-memory storage (I just learned), and as such much more efficient than rawfile_json.
    I am looking forward to your judgement.

    The documentation on returners implies indeed that storing data the master requires the job_cache.
    But this is strange - can I not unconfigure the job_cache, to save load on the master?

    Also, we are looking for a method to copy event data that arrives at the master, much like UNIX tee.
    If a module requires prep_jif, save_load, get_load, get_jid, get_fun, get_jis, and get_minions than this is not the module we are looking for. This is a much more complex module, and seems a replacement of the cache.
    What am I missing here?

    Finally, my ExtraData: unpack(b) received extra data Error:

    root@debian8: # salt-call --versions-report
    Salt Version:
              Salt: 2016.11.3
    
    Dependency Versions:
              cffi: 0.8.6
          cherrypy: Not Installed
          dateutil: 2.2
             gitdb: 0.5.4
         gitpython: 0.3.2 RC1
             ioflo: Not Installed
            Jinja2: 2.9.4
           libgit2: Not Installed
           libnacl: Not Installed
          M2Crypto: Not Installed
              Mako: Not Installed
      msgpack-pure: Not Installed
    msgpack-python: 0.4.2
      mysql-python: 1.2.3
         pycparser: 2.10
          pycrypto: 2.6.1
            pygit2: Not Installed
            Python: 2.7.9 (default, Jun 29 2016, 13:08:31)
      python-gnupg: Not Installed
            PyYAML: 3.11
             PyZMQ: 14.4.0
              RAET: Not Installed
             smmap: 0.8.2
           timelib: Not Installed
           Tornado: 4.2.1
               ZMQ: 4.0.5
    
    System Versions:
              dist: debian 8.7
           machine: x86_64
           release: 3.16.0-4-amd64
            system: Linux
           version: debian 8.7
    

    Minion

    C:\git\salt-windows-msi>\salt\salt-call.bat --versions-report
    Salt Version:
               Salt: 2016.11.3
    
    Dependency Versions:
               cffi: 1.7.0
           cherrypy: 7.1.0
           dateutil: 2.5.3
              gitdb: 0.6.4
          gitpython: 2.0.8
              ioflo: 1.5.5
             Jinja2: 2.9.4
            libgit2: Not Installed
            libnacl: 1.4.5
           M2Crypto: Not Installed
               Mako: 1.0.4
       msgpack-pure: Not Installed
     msgpack-python: 0.4.8
       mysql-python: Not Installed
          pycparser: 2.14
           pycrypto: 2.6.1
             pygit2: Not Installed
             Python: 2.7.12 (v2.7.12:d33e0cf91556, Jun 27 2016, 15:24:40) [MSC v.1500 64 bit (AMD64)]
       python-gnupg: 0.3.8
             PyYAML: 3.11
              PyZMQ: 16.0.1
               RAET: Not Installed
              smmap: 0.9.0
            timelib: 0.2.4
            Tornado: 4.4.1
                ZMQ: 4.1.6
    
    System Versions:
               dist:
            machine: AMD64
            release: 7
             system: Windows
            version: 7 6.1.7601 SP1 Multiprocessor Free
    

    Stacktrace

    root@debian8:# salt bob test.version
    [CRITICAL] Could not deserialize msgpack message.This often happens when trying to read a file no                       t in binary modeTo see message payload, enable debug logging and retry. Exception: unpack(b) rece                       ived extra data.
    [ERROR   ] Uncaught exception, closing connection.
    Traceback (most recent call last):
      File "/usr/lib/python2.7/dist-packages/zmq/eventloop/zmqstream.py", line 407, in _run_callback
        callback(*args, **kwargs)
      File "/usr/lib/python2.7/dist-packages/tornado/stack_context.py", line 275, in null_wrapper
        return fn(*args, **kwargs)
      File "/usr/lib/python2.7/dist-packages/salt/transport/zeromq.py", line 964, in mark_future
        data = self.serial.loads(msg[0])
      File "/usr/lib/python2.7/dist-packages/salt/payload.py", line 137, in loads
        ret = msgpack.loads(msg, use_list=True, encoding=encoding)
      File "_unpacker.pyx", line 123, in msgpack._unpacker.unpackb (msgpack/_unpacker.cpp:123)
    ExtraData: unpack(b) received extra data.
    [ERROR   ] Uncaught exception, closing connection.
    Traceback (most recent call last):
      File "/usr/lib/python2.7/dist-packages/zmq/eventloop/zmqstream.py", line 433, in _handle_events
        self._handle_recv()
      File "/usr/lib/python2.7/dist-packages/zmq/eventloop/zmqstream.py", line 465, in _handle_recv
        self._run_callback(callback, msg)
      File "/usr/lib/python2.7/dist-packages/zmq/eventloop/zmqstream.py", line 407, in _run_callback
        callback(*args, **kwargs)
      File "/usr/lib/python2.7/dist-packages/tornado/stack_context.py", line 275, in null_wrapper
        return fn(*args, **kwargs)
      File "/usr/lib/python2.7/dist-packages/salt/transport/zeromq.py", line 964, in mark_future
        data = self.serial.loads(msg[0])
      File "/usr/lib/python2.7/dist-packages/salt/payload.py", line 137, in loads
        ret = msgpack.loads(msg, use_list=True, encoding=encoding)
      File "_unpacker.pyx", line 123, in msgpack._unpacker.unpackb (msgpack/_unpacker.cpp:123)
    ExtraData: unpack(b) received extra data.
    [ERROR   ] Exception in callback None
    Traceback (most recent call last):
      File "/usr/lib/python2.7/dist-packages/tornado/ioloop.py", line 866, in start
        handler_func(fd_obj, events)
      File "/usr/lib/python2.7/dist-packages/tornado/stack_context.py", line 275, in null_wrapper
        return fn(*args, **kwargs)
      File "/usr/lib/python2.7/dist-packages/zmq/eventloop/zmqstream.py", line 433, in _handle_events
        self._handle_recv()
      File "/usr/lib/python2.7/dist-packages/zmq/eventloop/zmqstream.py", line 465, in _handle_recv
        self._run_callback(callback, msg)
      File "/usr/lib/python2.7/dist-packages/zmq/eventloop/zmqstream.py", line 407, in _run_callback
        callback(*args, **kwargs)
      File "/usr/lib/python2.7/dist-packages/tornado/stack_context.py", line 275, in null_wrapper
        return fn(*args, **kwargs)
      File "/usr/lib/python2.7/dist-packages/salt/transport/zeromq.py", line 964, in mark_future
        data = self.serial.loads(msg[0])
      File "/usr/lib/python2.7/dist-packages/salt/payload.py", line 137, in loads
        ret = msgpack.loads(msg, use_list=True, encoding=encoding)
      File "_unpacker.pyx", line 123, in msgpack._unpacker.unpackb (msgpack/_unpacker.cpp:123)
    ExtraData: unpack(b) received extra data.
    
    
  9. marbx commented on Apr 16, 2017

    @marbx
    Contributor

    Good news

    I found my mistake with the master configuring.
    Adding master_job_cache: rawfile_json to the master config provokes the stacktraces shown above.
    Adding event_return: rawfile_json make the function work :-)

    It seems it would be usefull to add event_return to the rawfile_json documentation.

    root@debian8:/etc/salt/master.d# cat markus.conf
    
    # Enable rawfile_json returner as a Master Job Cache (Master-side)
    event_return: rawfile_json
    
    # Specify the filename
    # https://docs.saltstack.com/en/latest/ref/returners/all/salt.returners.rawfile_json.html
    # Default is /var/log/salt/events.
    rawfile_json.filename: /var/log/salt/events22
    
    

    Test

    root@debian8:# salt bob test.version 
    root@debian8:# grep test.version /var/log/salt/events22
    {"tag": "salt/job/20170417010733089582/new", "data": {"tgt_type": "glob", "jid": "20170417010733089582", "tgt": "bob", "_stamp": "2017-04-16T23:07:33.092513", "user": "root", "arg": [], "fun": "test.version", "minions": ["bob"]}}
    {"tag": "salt/job/20170417010733089582/ret/bob", "data": {"fun_args": [], "jid": "20170417010733089582", "return": "2016.11.3", "retcode": 0, "success": true, "cmd": "_return", "_stamp": "2017-04-16T23:07:35.153221", "fun": "test.version", "id": "bob"}}
    
  10. marbx commented on Apr 17, 2017

    @marbx
    Contributor

    What do you think of this description?

  11. stale commented on Oct 6, 2018

    @stale

    This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

    If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.

  12. 19 remaining items

  13. self-assigned this
    on Sep 5, 2023
  14. dwoz commented on Oct 15, 2026

    @dwoz
    Contributor

    Thanks for the original report. This issue has been open for more than three years without recent activity and carries a severity label below severity-high. As part of a backlog cleanup, we're closing older low- and medium-severity issues so triage can focus on reports against currently supported releases.

    Closing isn't a judgement that the problem wasn't real — only that the codebase has moved through several releases since this was filed, and much of the surrounding code has changed.

    If you — or anyone else — can still reproduce this on the 3008.x LTS release, please leave a comment with a reproduction and a maintainer will reopen. The original reporter can also reopen directly.

  15. dwoz commented on Oct 17, 2026

    @dwoz
    Contributor

    Reopening — there is an open PR tracking a fix for this: #69564.

  16. reopened this on Oct 17, 2026
  17. dwoz commented on Oct 28, 2026

    @dwoz
    Contributor

    Closing — consolidated into #70585. The checkbox for this item is in the appropriate theme section of that tracker. Please pick up the sub-item there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Returnersbugdocumentationseverity-mediumtime-estimate-sprint

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions