Uploaded image for project: 'vpp'
  1. vpp
  2. VPP-959

TypeError: from_buffer() cannot return the address of the raw string within a str or unicode or bytearray object

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: High High
    • 18.01
    • 17.10
    • Python API binding
    • None

      The cFFI from_buffer() function assumes the latest version which is not the case with OPNFV. OPNFV uses version 1.5.2 of python-cffi whereas support for bytearray objects was added to from_buffer(0 from version 1.7 onwards:

       

      http://cffi.readthedocs.io/en/latest/ref.html

      New in version 1.10: the python_buffer can be anything supporting the buffer/memoryview interface (except unicode strings). Previously, bytearray objects were supported in version 1.7 onwards (careful, if you resize the bytearray, the <cdata> object will point to freed memory); and byte strings were supported in version 1.8 onwards.

       

      The result is that networking-vpp is stuck in a loop at the following exception:

       

      Aug 17 12:23:39 overcloud-controller-0 vpp-agent: 2017-08-17 12:23:39.962 152840 ERROR networking_vpp.agent.server   File "/usr/lib/python2.7/site-packages/networking_vpp/agent/vpp.py", line 226, in call_vpp

      Aug 17 12:23:39 overcloud-controller-0 vpp-agent: 2017-08-17 12:23:39.962 152840 ERROR networking_vpp.agent.server     t = func_call(*args, **kwargs)

      Aug 17 12:23:39 overcloud-controller-0 vpp-agent: 2017-08-17 12:23:39.962 152840 ERROR networking_vpp.agent.server   File "/usr/lib/python2.7/site-packages/vpp_papi.py", line 391, in <lambda>

      Aug 17 12:23:39 overcloud-controller-0 vpp-agent: 2017-08-17 12:23:39.962 152840 ERROR networking_vpp.agent.server     **kwargs))

      Aug 17 12:23:39 overcloud-controller-0 vpp-agent: 2017-08-17 12:23:39.962 152840 ERROR networking_vpp.agent.server   File "/usr/lib/python2.7/site-packages/vpp_papi.py", line 587, in _call_vpp

      Aug 17 12:23:39 overcloud-controller-0 vpp-agent: 2017-08-17 12:23:39.962 152840 ERROR networking_vpp.agent.server     self._write(b)

      Aug 17 12:23:39 overcloud-controller-0 vpp-agent: 2017-08-17 12:23:39.962 152840 ERROR networking_vpp.agent.server   File "/usr/lib/python2.7/site-packages/vpp_papi.py", line 436, in _write

      Aug 17 12:23:39 overcloud-controller-0 vpp-agent: 2017-08-17 12:23:39.962 152840 ERROR networking_vpp.agent.server     return vpp_api.vac_write(ffi.from_buffer(buf), len(buf))

      Aug 17 12:23:39 overcloud-controller-0 vpp-agent: 2017-08-17 12:23:39.962 152840 ERROR networking_vpp.agent.server   File "/usr/lib64/python2.7/site-packages/cffi/api.py", line 323, in from_buffer

      Aug 17 12:23:39 overcloud-controller-0 vpp-agent: 2017-08-17 12:23:39.962 152840 ERROR networking_vpp.agent.server     return self._backend.from_buffer(self.BCharA, python_buffer)

      Aug 17 12:23:39 overcloud-controller-0 vpp-agent: 2017-08-17 12:23:39.962 152840 ERROR networking_vpp.agent.server TypeError: from_buffer() cannot return the address of the raw string within a str or unicode or bytearray object

            otroan Ole Trøan
            ot Onong Tayeng
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: