Uploaded image for project: 'Ambari'
  1. Ambari
  2. AMBARI-26099

Ambari Common Stomp Module AttributeError

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 3.0.0
    • ambari-trunk
    • None

    Description

      When using ambari_stomp module to send or recieve message, there will be an error

       

      Exception in thread StompReceiverThread-1:
      Traceback (most recent call last):
        File "/home/peng/Desktop/202309/pythonlab/python3819/lib/python3.8/threading.py", line 932, in _bootstrap_inner
          self.run()
        File "/home/peng/Desktop/202309/pythonlab/python3819/lib/python3.8/threading.py", line 870, in run
          self._target(*self._args, **self._kwargs)
        File "/home/peng/Desktop/projects/ambari/ambari-common/src/main/python/ambari_stomp/transport.py", line 334, in __receiver_loop
          frames = self.__read()
        File "/home/peng/Desktop/projects/ambari/ambari-common/src/main/python/ambari_stomp/transport.py", line 380, in __read
          if c.encode() == b'\x0a' and not self.__recvbuf and not fastbuf.tell():
      AttributeError: 'bytes' object has no attribute 'encode' 

      here is my test case.(Before testing, please download the testcase.zip)

       
      1) Add ambari-common to PYTHONPATH

      export PYTHONPATH=$PYTHONPATH:${your_ambari_common_home}/src/main/python 

      2) Start local stompserver

      bash run.sh  

      3) Test it

      python3 python/demo1.py test 

      Attachments

        1. testcase.zip
          23 kB
          Shuaipeng Lee
        2. image-2024-08-16-13-35-38-410.png
          36 kB
          LiJie2023
        3. image-2024-08-16-13-37-16-857.png
          38 kB
          LiJie2023

        Issue Links

          Activity

            People

              Unassigned Unassigned
              bigboy001 Shuaipeng Lee
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 2h 10m
                  2h 10m