You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "Ivan Andika (Jira)" <ji...@apache.org> on 2026/10/23 07:58:00 UTC
[jira] [Updated] (HDDS-17378) DatanodeStateMachine is not properly constructed
[ https://issues.apache.org/jira/browse/HDDS-17378?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Ivan Andika updated HDDS-17378:
-------------------------------
Description:
DatanodeStateMachine "this" reference escapes during its construction. See the following implementation below
{code:java}
context = new StateContext(this.conf, DatanodeStates.getInitState(), this,
threadNamePrefix);
{code}
From "Java Concurrency in Practice", this means the DatanodeStateMachine is {_}not properly constructed{_}.
See the excerpt: "An object is in a predictable, consistent state only after its constructor returns, so publishing an object from within its constructor can publish an incompletely constructed object"
And the exact imperative "Do not allow the `this` reference to escape during construction"
This issue seems to cause the workaround of having constructionLock in DatanodeStateMachine (see HDDS-3116).
This can be improved.
was:
DatanodeStateMachine "this" reference escapes during its construction. See the following implementation below
{code:java}
context = new StateContext(this.conf, DatanodeStates.getInitState(), this,
threadNamePrefix);
{code}
From "Java Concurrency in Practice", this means the DatanodeStateMachine is {_}not properly constructed{_}.
See the excerpt: "An object is in a predictable, consistent state only after its constructor returns, so publishing an object from within its constructor can publish an incompletely constructed object"
And the exact imperative "Do not allow the `this` reference to escape during construction"
This issue seems to cause the workaround of having constructionLock in HDDS-3116.
This can be improved.
> DatanodeStateMachine is not properly constructed
> ------------------------------------------------
>
> Key: HDDS-17378
> URL: https://issues.apache.org/jira/browse/HDDS-17378
> Project: Apache Ozone
> Issue Type: Bug
> Reporter: Ivan Andika
> Assignee: Ivan Andika
> Priority: Major
>
> DatanodeStateMachine "this" reference escapes during its construction. See the following implementation below
> {code:java}
> context = new StateContext(this.conf, DatanodeStates.getInitState(), this,
> threadNamePrefix);
> {code}
> From "Java Concurrency in Practice", this means the DatanodeStateMachine is {_}not properly constructed{_}.
> See the excerpt: "An object is in a predictable, consistent state only after its constructor returns, so publishing an object from within its constructor can publish an incompletely constructed object"
> And the exact imperative "Do not allow the `this` reference to escape during construction"
> This issue seems to cause the workaround of having constructionLock in DatanodeStateMachine (see HDDS-3116).
> This can be improved.
>
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org