[ 
https://issues.apache.org/jira/browse/PROTON-1465?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Nico Maas updated PROTON-1465:
------------------------------
    Description: 
I use Qpid in Python to send files and do it this way:

{code}
from __future__ import print_function, unicode_literals
# qpid-proton
from proton import Message
from proton.utils import BlockingConnection
from proton.handlers import IncomingMessageHandler

activemq_channel = ""
activemq_connection = ""
activemq_session = ""
activemq_sender = ""

def mq_connect(ip, username, password):
  global activemq_channel
  global activemq_connection
  global activemq_session
  global activemq_sender
  activemq_connection = BlockingConnection(username + ":" + password + "@" + ip 
+ ":5672")
  activemq_sender = activemq_connection.create_sender("file")

def mq_send(data):
  global activemq_sender
  #activemq_sender.send(Message(bytearray(data)))
  activemq_sender.send(Message(durable=True,body=data))

def mq_close():
  global activemq_connection
  activemq_connection.close()

mq_connect(server_ip,'admin','admin')
for i in file_list:
  data = open(i, 'rb')
  mq_send(data.read())
  data.close()
mq_close.close()
{code}


Sadly I could not send the files as bytearrays as I normally do.. but it should 
work (Is there any better way to send binary files via proton?). However, on 
random, following problem arises:

{code}
Traceback (most recent call last):
  File "./send_activemq.py", line 323, in <module>
    mq_send(data.read())
  File "./send_activemq.py", line 271, in mq_send
    activemq_sender.send(Message(body=data))
  File "/usr/local/lib/python2.7/dist-packages/proton/utils.py", line 78, in 
send
    self.connection.wait(lambda: _is_settled(delivery), msg="Sending on sender 
%s" % self.link.name, timeout=timeout)
  File "/usr/local/lib/python2.7/dist-packages/proton/utils.py", line 267, in 
wait
    self.container.process()
  File "/usr/local/lib/python2.7/dist-packages/proton/reactor.py", line 159, in 
process
    self._check_errors()
  File "/usr/local/lib/python2.7/dist-packages/proton/reactor.py", line 155, in 
_check_errors
    _compat.raise_(exc, value, tb)
  File "/usr/local/lib/python2.7/dist-packages/proton/__init__.py", line 4050, 
in dispatch
    ev.dispatch(self.handler)
  File "/usr/local/lib/python2.7/dist-packages/proton/__init__.py", line 3959, 
in dispatch
    result = dispatch(handler, type.method, self)
  File "/usr/local/lib/python2.7/dist-packages/proton/__init__.py", line 3837, 
in dispatch
    return m(*args)
  File "/usr/local/lib/python2.7/dist-packages/proton/utils.py", line 289, in 
on_connection_remote_close
    raise ConnectionClosed(event.connection)
proton.utils.ConnectionClosed: Connection x closed due to: 
Condition('amqp:decode-error', 'Could not process AMQP commands')
{code}

ActiveMQ tells me following:
{code}
 WARN | Transport Connection to: tcp://x:59158 failed: 
org.apache.activemq.transport.amqp.AmqpProtocolException: Could not process 
AMQP commands
 WARN | Transport Connection to: tcp://x:55804 failed: java.io.EOFException
{code}

However, it always happens at random - without any clue on the file, size or 
time..

What can I do? Python crashes at this point... So it is a blocker for me. 
Thanks a lot for your help.

  was:
I use Qpid in Python to send files and do it this way:

{code}
from __future__ import print_function, unicode_literals
# qpid-proton
from proton import Message
from proton.utils import BlockingConnection
from proton.handlers import IncomingMessageHandler

activemq_channel = ""
activemq_connection = ""
activemq_session = ""
activemq_sender = ""

def mq_connect(ip, username, password):
  global activemq_channel
  global activemq_connection
  global activemq_session
  global activemq_sender
  activemq_connection = BlockingConnection(username + ":" + password + "@" + ip 
+ ":5672")
  activemq_sender = activemq_connection.create_sender("file")

def mq_send(data):
  global activemq_sender
  #activemq_sender.send(Message(bytearray(data)))
  activemq_sender.send(Message(durable=True,body=data))

def mq_close():
  global activemq_connection
  activemq_connection.close()

mq_connect(server_ip,'admin','admin')
for i in file_list:
  data = open(i, 'rb')
  mq_send(data.read())
  data.close()
mq_close.close()
{code}


Sadly I could not send bytearrays as I normally do.. but it should work. 
However, on random, following problem arises:


{code}
Traceback (most recent call last):
  File "./send_activemq.py", line 323, in <module>
    mq_send(data.read())
  File "./send_activemq.py", line 271, in mq_send
    activemq_sender.send(Message(body=data))
  File "/usr/local/lib/python2.7/dist-packages/proton/utils.py", line 78, in 
send
    self.connection.wait(lambda: _is_settled(delivery), msg="Sending on sender 
%s" % self.link.name, timeout=timeout)
  File "/usr/local/lib/python2.7/dist-packages/proton/utils.py", line 267, in 
wait
    self.container.process()
  File "/usr/local/lib/python2.7/dist-packages/proton/reactor.py", line 159, in 
process
    self._check_errors()
  File "/usr/local/lib/python2.7/dist-packages/proton/reactor.py", line 155, in 
_check_errors
    _compat.raise_(exc, value, tb)
  File "/usr/local/lib/python2.7/dist-packages/proton/__init__.py", line 4050, 
in dispatch
    ev.dispatch(self.handler)
  File "/usr/local/lib/python2.7/dist-packages/proton/__init__.py", line 3959, 
in dispatch
    result = dispatch(handler, type.method, self)
  File "/usr/local/lib/python2.7/dist-packages/proton/__init__.py", line 3837, 
in dispatch
    return m(*args)
  File "/usr/local/lib/python2.7/dist-packages/proton/utils.py", line 289, in 
on_connection_remote_close
    raise ConnectionClosed(event.connection)
proton.utils.ConnectionClosed: Connection x closed due to: 
Condition('amqp:decode-error', 'Could not process AMQP commands')
{code}

ActiveMQ tells me following:
{code}
 WARN | Transport Connection to: tcp://x:59158 failed: 
org.apache.activemq.transport.amqp.AmqpProtocolException: Could not process 
AMQP commands
 WARN | Transport Connection to: tcp://x:55804 failed: java.io.EOFException
{code}

However, it always happens at random - without any clue on the file, size or 
time..

What can I do?


> amqp:decode-error Could not process AMQP commands
> -------------------------------------------------
>
>                 Key: PROTON-1465
>                 URL: https://issues.apache.org/jira/browse/PROTON-1465
>             Project: Qpid Proton
>          Issue Type: Bug
>          Components: python-binding
>    Affects Versions: 0.17.0
>         Environment: Ubuntu 14.04
>            Reporter: Nico Maas
>
> I use Qpid in Python to send files and do it this way:
> {code}
> from __future__ import print_function, unicode_literals
> # qpid-proton
> from proton import Message
> from proton.utils import BlockingConnection
> from proton.handlers import IncomingMessageHandler
> activemq_channel = ""
> activemq_connection = ""
> activemq_session = ""
> activemq_sender = ""
> def mq_connect(ip, username, password):
>   global activemq_channel
>   global activemq_connection
>   global activemq_session
>   global activemq_sender
>   activemq_connection = BlockingConnection(username + ":" + password + "@" + 
> ip + ":5672")
>   activemq_sender = activemq_connection.create_sender("file")
> def mq_send(data):
>   global activemq_sender
>   #activemq_sender.send(Message(bytearray(data)))
>   activemq_sender.send(Message(durable=True,body=data))
> def mq_close():
>   global activemq_connection
>   activemq_connection.close()
> mq_connect(server_ip,'admin','admin')
> for i in file_list:
>   data = open(i, 'rb')
>   mq_send(data.read())
>   data.close()
> mq_close.close()
> {code}
> Sadly I could not send the files as bytearrays as I normally do.. but it 
> should work (Is there any better way to send binary files via proton?). 
> However, on random, following problem arises:
> {code}
> Traceback (most recent call last):
>   File "./send_activemq.py", line 323, in <module>
>     mq_send(data.read())
>   File "./send_activemq.py", line 271, in mq_send
>     activemq_sender.send(Message(body=data))
>   File "/usr/local/lib/python2.7/dist-packages/proton/utils.py", line 78, in 
> send
>     self.connection.wait(lambda: _is_settled(delivery), msg="Sending on 
> sender %s" % self.link.name, timeout=timeout)
>   File "/usr/local/lib/python2.7/dist-packages/proton/utils.py", line 267, in 
> wait
>     self.container.process()
>   File "/usr/local/lib/python2.7/dist-packages/proton/reactor.py", line 159, 
> in process
>     self._check_errors()
>   File "/usr/local/lib/python2.7/dist-packages/proton/reactor.py", line 155, 
> in _check_errors
>     _compat.raise_(exc, value, tb)
>   File "/usr/local/lib/python2.7/dist-packages/proton/__init__.py", line 
> 4050, in dispatch
>     ev.dispatch(self.handler)
>   File "/usr/local/lib/python2.7/dist-packages/proton/__init__.py", line 
> 3959, in dispatch
>     result = dispatch(handler, type.method, self)
>   File "/usr/local/lib/python2.7/dist-packages/proton/__init__.py", line 
> 3837, in dispatch
>     return m(*args)
>   File "/usr/local/lib/python2.7/dist-packages/proton/utils.py", line 289, in 
> on_connection_remote_close
>     raise ConnectionClosed(event.connection)
> proton.utils.ConnectionClosed: Connection x closed due to: 
> Condition('amqp:decode-error', 'Could not process AMQP commands')
> {code}
> ActiveMQ tells me following:
> {code}
>  WARN | Transport Connection to: tcp://x:59158 failed: 
> org.apache.activemq.transport.amqp.AmqpProtocolException: Could not process 
> AMQP commands
>  WARN | Transport Connection to: tcp://x:55804 failed: java.io.EOFException
> {code}
> However, it always happens at random - without any clue on the file, size or 
> time..
> What can I do? Python crashes at this point... So it is a blocker for me. 
> Thanks a lot for your help.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to