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

bugfix for #79411 Connect with invalid password exits #30

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pmorch
Copy link

@pmorch pmorch commented Feb 24, 2013

This is a fix for Bug #79411 for Net--RabbitMQ: Connect with invalid password exits

The problem was that write was called on closed sockets. That caused
SIGPIPE signals that weren't handled.

It is fixed by introducing write_ignore_pipe_signal() that sets up a
short-lived signal handler SIGPIPE that simply ignores the signal
while write() is called.

write_ignore_pipe_signal() is now called everywhere that write() used to
be called directly.

The problem was that write was called on closed sockets. That caused
SIGPIPE signals that weren't handled.

It is fixed by introducing write_ignore_pipe_signal() that sets up a
short-lived signal handler SIGPIPE that simply ignores the signal
while write() is called.

write_ignore_pipe_signal() is now called everywhere that write() used to
be called directly.
@emarcotte
Copy link

It'd be even nicer to upgrade to newer rabbitmq-c which doesn't SIGPIPE on write, rather than deviate further from the library. Something like like #14 or going further and fully separating Net::RabbitMQ from rabbitmq-c would be great.

@pmorch
Copy link
Author

pmorch commented Feb 26, 2013

I wasn't aware that Net::RabbitMQ included code from rabbitmq-c. :-(

I looked at #14 "Upgrading to rabbitmq-c-fb6fca832fd2 and removing unsupported features.". Unfortunately, I tried checking out https://github.com/MattiL/Net--RabbitMQ.git (which includes #14) and the bug is still there in that version: process still exits with SIGPIPE under similar circumstances.

Furthermore, that commit does several things: Upgrades and removes unsupported features. In addition, fb6fca832fd2 is not a valid/existing commit in the rabbitmq-c project, so I have no idea what version of rabbitmq-c was upgraded to. At the very least, the Set MSG_NOSIGNAL flag to supress SIGPIPE in send() · 815f521 · alanxz/rabbitmq-c commit, that fixes the SIGPIPE in rabbitmq-c, is not included in the #14 fix.

So it looks like #14 needs to be redone or at least investigated, and rabbitmq-c commit 815f521 included. Currently trying to merge #14 into master causes massive merge conflicts, so that isn't straight-forward. But I agree that merging in a new rabbitmq-c is the solution.

At this time, upgrading rabbitmq-c to newest version looks like a task that requires more insight into RabbitMQ and tools than I have, and is a little larger than I'm up to.

In the meantime the SIGPIPE problem is still there. My comparatively tiny merge request fixes it.

@pmorch
Copy link
Author

pmorch commented Feb 26, 2013

After a little more investigation, it looks like MattiL did the upgrade of rabbitmq-c (to some unknown version of rabbitmq-c) in #14. In that pull-request postwait commented:

Removing all the features that were added into Net::RabbitMQ isn't really an acceptable step. If you want to update the rabbitmq-c stuff, pull the new sources and merge in the additions we've make over time in the Net::RabbitMQ source base. Those changes are critical to make this module useful for AMQP interaction within Perl.

It looks like another unknown but older version of rabbitmq-c was imported in the very first commit in this project in 2009, and hasn't been updated since. But there have been approx 850 lines of diff since then in the originally imported rabbitmq-c files:

git archive 40f23726b2ecb6c4482f1852660034ed3ff7cc2b -- librabbitmq | tar x
diff -u librabbitmq/ . | grep -v '^Only in' | wc -l
858

I just took a look of some of these diffs, and they look non-trivial to port over. rabbitmq-c has changed a lot since 2009.

A question for omniti-labs, postwait & core contributors:

Is there a way we could cleanly use rabbitmq-c as-is? And turn any necessary changes we need in rabbitmq-c into a clean pull-request for that project? That way it would also be much easier in the future to keep up with master/HEAD in rabbitmq-c in the future. Is there a plan for that?

Alternatively, is there a plan for how to keep up with the many, many changes in rabbitmq-c?

It seems to me that rabbitmq-c was effectively forked in 2009 for this project, and the two projects have diverged significantly since.

Of course this is high-priority for me :-) - but I can't imagine a worse category of bug:

This pull-request fixes the problem where if one restarts the rabbitmq server, then on the next operation any perl client process exits without an error message or anything, and eval doesn't even do the trick.

I hope the desire to eventually upgrade / keep up with rabbitmq-c does not prevent pulling this issue for now.

@emarcotte
Copy link

We've done a bit of work locally to try and do this split without having to compromise too much on the feature loss. Unfortunately we haven't yet been able to get a basic return callback working (this requires modifications to rabbitmq-c to let us inspect the local memory queue of messages). You can see the work in progress at: https://github.com/emarcotte/Net--RabbitMQ. I just rolled up all of our current work and submitted it.

@pmorch
Copy link
Author

pmorch commented Mar 7, 2013

Hi emarcotte,

I tried to visit https://github.com/emarcotte/Net--RabbitMQ, but it dead (404). Do you have the work in progress somewhere else?

Peter

@emarcotte
Copy link

@pmorch Sorry it should be back shortly, sorry still in the process of pushing it to github

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

Successfully merging this pull request may close these issues.

2 participants