Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stack Overflow in Client #6

Closed
ballcoach12 opened this issue Apr 20, 2016 · 11 comments
Closed

Stack Overflow in Client #6

ballcoach12 opened this issue Apr 20, 2016 · 11 comments

Comments

@ballcoach12
Copy link

ballcoach12 commented Apr 20, 2016

I am testing the performance of the dart_amqp client. I am publishing 100,000 messages in my test, and then receiving them in a separate client. I am basically using the code from your readme example, except that I added a loop to publish the messages:

`Client publisher = new Client(settings : settings);

publisher
.channel()
.then((Channel channel) {
channel.queue('logs').then((Queue q) {

  channel.exchange("logs", ExchangeType.FANOUT)
      .then((Exchange exchange) {
    q.bind(exchange,'logs');
    int x = 0;
    while(x < 100000) {
    exchange.publish("Testing 1-2-3", 'logs');
      x++;
    }
    return publisher.close();
  });`

My client code is exactly the same as your readme example.

When I start the publisher and then start the server, I begin to receive messages, but then, after processing 4500 messages, I get a stack overflow exception:

Unhandled exception:
Stack Overflow
#0 _startMicrotaskLoop (dart:async/schedule_microtask.dart:51)
#1 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:96)
#2 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:149)
#3 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:96)
#4 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:149)
#5 RawFrameParser.handleData (package:dart_amqp/src/protocol/io/raw_frame_parser.dart:79:9)
#6 RawFrameParser.handleData (package:dart_amqp/src/protocol/io/raw_frame_parser.dart:79:9)
#7 RawFrameParser.handleData (package:dart_amqp/src/protocol/io/raw_frame_parser.dart:79:9)
#8 RawFrameParser.handleData (package:dart_amqp/src/protocol/io/raw_frame_parser.dart:79:9)
#9 RawFrameParser.handleData (package:dart_amqp/src/protocol/io/raw_frame_parser.dart:79:9)

...
...
#10 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341)
#11 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:270)
#12 _StreamController&&_SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:744)
#13 _StreamController._add (dart:async/stream_controller.dart:616)
#14 _StreamController.add (dart:async/stream_controller.dart:562)
#15 _RawSocket._RawSocket. (dart:io-patch/socket_patch.dart:1215)
#16 _NativeSocket.issueReadEvent.issue (dart:io-patch/socket_patch.dart:749)
#17 _microtaskLoop (dart:async/schedule_microtask.dart:41)
#18 _startMicrotaskLoop (dart:async/schedule_microtask.dart:50)
#19 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:96)
#20 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:149)

Am I doing something wrong here?

@rajmaniar
Copy link
Contributor

Hi There,
The above code works fine for me with RabbitMQ 3.5.4 and Dart 1.15.0 (64bit mac sdk).
What version of the dartVM are you using, what platform and what queue service?

Thanks!

@ballcoach12
Copy link
Author

I am using Dart VM 1.14.2 on 64-bit Mac, with RabbitMQ 3.6.1.

@achilleasa
Copy link
Owner

Hmmm, it looks like the driver gets stuck trying to extract consecutive AMQP frames from the same data stream (extracted first but couldn't consume the data for the next). I will try to replicate the issue using the rabbit/dart versions you mention above.

In the meantime, can you please try adding some print statements before the call to handleData?
We should check if _parsedHeader is null (and its contents if not), as well as _inputBuffer.length

@ballcoach12
Copy link
Author

ballcoach12 commented Apr 20, 2016

Thanks for the quick reply. I added the print statements that you mentioned, and the output from the Dart console is attached.

Interestingly, in the capture it still shows a stack overflow, but it fails in processing the exception type, which is different than the first exception that I posted. But if I run my test again, the originally-posted exception is thrown.

capture.txt

@ballcoach12
Copy link
Author

Here is another capture of the Dart console with the contents of _parsedHeader.

capture2.txt

@achilleasa
Copy link
Owner

achilleasa commented Apr 20, 2016

Thanks for the captures.

Can you also try running the same test against Rabbit 3.5.4 (or 3.5.7)

@ballcoach12
Copy link
Author

We don't get an exception thrown when running against Rabbit 3.5.4.

@rajmaniar
Copy link
Contributor

I tested with Rabbit 3.6.1 and I'm not able to reproduce the exception. :(

@achilleasa
Copy link
Owner

I was able to reproduce the issue with rabbit 3.6.1 and pushed a923727 on master that addresses the problem.

Can you try checking out the latest master and running your test against that?

If everything works I will bump the version and push an updated package tomorrow

@ballcoach12
Copy link
Author

Yes. I will try it ASAP.

Thanks!

On Wednesday, April 20, 2016, Achilleas Anagnostopoulos <
notifications@github.com> wrote:

I was able to reproduce the issue with rabbit 3.6.1 and pushed a923727
a923727
on master that addresses the problem.

Can you try checking out the latest master and running your test against
that?

If everything works I will bump the version and push an updated package
tomorrow


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#6 (comment)

@ballcoach12
Copy link
Author

Tried the latest master, and got no exception. Thanks for the quick fix! Will be looking for the version bump.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants