Skip to content

[ROCKETMQ-166] onException callback may capture compressed message body#89

Closed
lizhanhui wants to merge 1 commit into
apache:developfrom
lizhanhui:ROCKETMQ-166
Closed

[ROCKETMQ-166] onException callback may capture compressed message body#89
lizhanhui wants to merge 1 commit into
apache:developfrom
lizhanhui:ROCKETMQ-166

Conversation

@lizhanhui

@lizhanhui lizhanhui commented Apr 6, 2017

Copy link
Copy Markdown
Contributor

If message body size exceeds specified threshold, client would try to compress the message body.
Here there are two issues: 1) current implementation changes message body directly, which is not a good practice; 2) if asynchronous send method is employed to deliver message, when onException is invoked, the callback may capture the compressed message body before the finally block restores it.

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.04%) to 31.927% when pulling 638a692 on lizhanhui:ROCKETMQ-166 into 45a64fd on apache:develop.

2 similar comments
@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.04%) to 31.927% when pulling 638a692 on lizhanhui:ROCKETMQ-166 into 45a64fd on apache:develop.

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.04%) to 31.927% when pulling 638a692 on lizhanhui:ROCKETMQ-166 into 45a64fd on apache:develop.

@lizhanhui

Copy link
Copy Markdown
Contributor Author

Comment to bump up this PR.

@vongosling

Copy link
Copy Markdown
Member

@shroman @stevenschew

@shroman shroman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but how about unit tests?

msgBody = UtilAll.compress(msgBody, zipCompressLevel);
} catch (IOException e) {
requestHeader.setSysFlag(MessageSysFlag.clearCompressedFlag(sysFlag));
log.error("tryToCompressMessage exception", e);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the reason to have ERROR and WARN here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean why we log error on failing to compress message body?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just wonder why both WARN and ERROR are needed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got your point.

  1. The code is moved here, and same log level should be applied IMO. @vongosling @vintagewang any particular reason behind this?

@lizhanhui

Copy link
Copy Markdown
Contributor Author

@stevenschew Any idea?

@vongosling

Copy link
Copy Markdown
Member

@lizhanhui I will close the pr, if you happened to the same question, please let me know.

@vongosling vongosling closed this Jul 14, 2018
pingww pushed a commit that referenced this pull request Aug 26, 2022
[ISSUE #22] Improving codeCov for mqtt.common
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.

4 participants