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

Update Netty to 4.1.16.Final #28345

Merged
merged 8 commits into from
Jan 25, 2018
Merged

Update Netty to 4.1.16.Final #28345

merged 8 commits into from
Jan 25, 2018

Conversation

jaymode
Copy link
Member

@jaymode jaymode commented Jan 23, 2018

This commit updates netty to 4.1.16.Final. This is the latest version that we can have work without
needing extra security permissions. This updated version of netty fixes issues seen with Java 9 and some data not being sent, which results in timeouts.

This commit updates netty to 4.1.18.Final. This is the latest version that we can have work with
the security manager. This updated version of netty fixes issues seen with Java 9 and some data
not being sent, which results in timeouts.
@jaymode jaymode added review :Distributed Coordination/Network Http and internode communication implementations v7.0.0 v6.3.0 v6.2.0 labels Jan 23, 2018
@jaymode jaymode requested a review from jasontedor January 23, 2018 19:43
@@ -17,6 +17,11 @@
* under the License.
*/

grant {
// needed for Netty since they use reflection in ThrowableUtil :(
permission java.lang.RuntimePermission "accessDeclaredMembers";
Copy link
Member

Choose a reason for hiding this comment

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

Can we open an issue in netty and link here that netty should work gracefully if it does not have this permission?

Copy link
Member Author

Choose a reason for hiding this comment

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

Opened netty/netty#7614 and added in the comment of this section

@jaymode
Copy link
Member Author

jaymode commented Jan 23, 2018

Netty 4.1.20.Final is available but there are a few issues that prevent us from upgrading. The main issue is in the GlobalEventExecutor. The startThread() method changes the thread's context class loader and does not use a doPrivileged block. This executor is used in a hardcoded fashion throughout the netty code so we cannot perform the wrapping for Netty (as a temporary workaround).

The ObjectCleaner class also has a similar issue in that the classloader is changed without a doPrivileged block and can be executed outside of our control.

@jaymode jaymode requested a review from Tim-Brooks January 23, 2018 20:43
Copy link
Member

@jasontedor jasontedor left a comment

Choose a reason for hiding this comment

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

I left a comment.


// TODO remove this once we get a fix into Netty so we don't have to do this
AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
ThrowableUtil.haveSuppressed();
Copy link
Member

Choose a reason for hiding this comment

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

Would you leave a comment that this is triggering class initialization? This is horrific.

Copy link
Member Author

Choose a reason for hiding this comment

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

I pushed b073780

Copy link
Member

@jasontedor jasontedor left a comment

Choose a reason for hiding this comment

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

LGTM.

Copy link
Member

@jasontedor jasontedor left a comment

Choose a reason for hiding this comment

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

Sorry after reviewing the implications of this I left another comment.

@@ -17,6 +17,12 @@
* under the License.
*/

grant {
Copy link
Member

Choose a reason for hiding this comment

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

Can we grant this only to transport-netty4?

Copy link
Member Author

Choose a reason for hiding this comment

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

I am pretty sure this is handled by the module framework?

Copy link
Member

Choose a reason for hiding this comment

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

That is correct. A general grant means all the jars in this plugin.

Copy link
Member

Choose a reason for hiding this comment

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

Not quite; it grants it to all JARs in the module and I am asking for this to be limited to transport-netty4 only.

Copy link
Member

Choose a reason for hiding this comment

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

Or whatever Netty JAR this is in.

Copy link
Member

Choose a reason for hiding this comment

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

That can't work since the doPriv block is in our module code.

Copy link
Member

Choose a reason for hiding this comment

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

It could be granted to our jar and the single netty jar explicitly though.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, that should have been an and, not an or.

Copy link
Contributor

@Tim-Brooks Tim-Brooks left a comment

Choose a reason for hiding this comment

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

LGTM - as I am good with whatever decision you, Jason, and Ryan make in regards to permissions.

@jaymode jaymode changed the title Update Netty to 4.1.18.Final Update Netty to 4.1.16.Final Jan 25, 2018
@jaymode
Copy link
Member Author

jaymode commented Jan 25, 2018

@jasontedor @rjernst I rolled the version back to 4.1.16.Final to avoid needing extra security permissions and the initialization hack. Can you please take a look?

Copy link
Member

@rjernst rjernst left a comment

Choose a reason for hiding this comment

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

LGTM, just one ask.

'io.netty.util.internal.shaded.org.jctools.queues.BaseMpscLinkedArrayQueueProducerFields',
'io.netty.util.internal.shaded.org.jctools.queues.MpscArrayQueueConsumerIndexField',
'io.netty.util.internal.shaded.org.jctools.queues.MpscArrayQueueProducerIndexField',
'io.netty.util.internal.shaded.org.jctools.queues.MpscArrayQueueProducerLimitField',
Copy link
Member

Choose a reason for hiding this comment

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

Seems like these got moved out of alphabetical order?

Copy link
Member

Choose a reason for hiding this comment

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

+1

@jasontedor
Copy link
Member

Thanks @jaymode. When @rjernst comment is addressed you can merge.

@jaymode jaymode merged commit e59f14d into elastic:master Jan 25, 2018
@jaymode jaymode deleted the netty_update branch January 25, 2018 19:48
jaymode added a commit that referenced this pull request Jan 25, 2018
This commit updates netty to 4.1.16.Final. This is the latest version that we can have work without
extra permissions. This updated version of netty fixes issues seen with Java 9 and some data
not being sent, which results in timeouts.
jaymode added a commit that referenced this pull request Jan 25, 2018
This commit updates netty to 4.1.16.Final. This is the latest version that we can have work without
extra permissions. This updated version of netty fixes issues seen with Java 9 and some data
not being sent, which results in timeouts.
jasontedor added a commit to matarrese/elasticsearch that referenced this pull request Jan 25, 2018
* master: (23 commits)
  Update Netty to 4.1.16.Final (elastic#28345)
  Fix peer recovery flushing loop (elastic#28350)
  REST high-level client: add support for exists alias (elastic#28332)
  REST high-level client: move to POST when calling API to retrieve which support request body (elastic#28342)
  Add Indices Aliases API to the high level REST client (elastic#27876)
  Java Api clean up: remove deprecated `isShardsAcked` (elastic#28311)
  [Docs] Fix explanation for `from` and `size` example (elastic#28320)
  Adapt bwc version after backport elastic#28358
  Always return the after_key in composite aggregation response (elastic#28358)
  Adds test name to MockPageCacheRecycler exception (elastic#28359)
  Adds a note in the `terms` aggregation docs regarding pagination (elastic#28360)
  [Test] Fix DiscoveryNodesTests.testDeltas() (elastic#28361)
  Update packaging tests to work with meta plugins (elastic#28336)
  Remove Painless Type from MethodWriter in favor of Java Class. (elastic#28346)
  [Doc] Fixs typo in reverse-nested-aggregation.asciidoc (elastic#28348)
  Reindex: Shore up rethrottle test
  Only assert single commit iff index created on 6.2
  isHeldByCurrentThread should return primitive bool
  [Docs] Clarify `html` encoder in highlighting.asciidoc (elastic#27766)
  Fix GeoDistance query example (elastic#28355)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants