Skip to content

Issue 6080 - ns-slapd crash in referint_get_config #6081

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

Merged
merged 1 commit into from
Mar 18, 2024

Conversation

tbordaz
Copy link
Contributor

@tbordaz tbordaz commented Feb 7, 2024

Bug description:
Referential integrity plugin spawn a thread to run
integrity check/update in a deferred way. It uses a log
file to pipe changes to check. The name of the file,
stored in the config, is read periodically.
At shutdown, referint plugin close callback notifies
the thread to stop and free the config.
The problem is that the thread may check the config
while it was notify to stop.

Fix description:
Check the notification (keeprunning) before reading
the config

relates: #6080

Reviewed by:

Copy link
Contributor

@progier389 progier389 left a comment

Choose a reason for hiding this comment

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

Sorry, but the fix looks wrong:
[1] Not sure you really want to lose the pending changes at shutdown
[2] It does not ensure that the thread is really stopped when destroying the config.
IMHO After resetting the keeprunning flag in referint_postop_close once the keeprunning_mutex is released you have to wait for the thread completion before going on with the clean up

@tbordaz
Copy link
Contributor Author

tbordaz commented Mar 15, 2024

Thanks for the review. You are correct the first patch was wrong. I changed the mechanism to sync plugin stop fct with the batch thread.

Copy link
Contributor

@progier389 progier389 left a comment

Choose a reason for hiding this comment

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

LGTM even I would have preferred the use of a wait_cond but atomic operation and sleep should also do the job !

Bug description:
	Referential integrity plugin spawn a thread to run
	integrity check/update in a deferred way. It uses a log
	file to pipe changes to check. The name of the file,
	stored in the config, is read periodically.
	At shutdown, referint plugin close callback notifies
	the thread to stop and free the config.
	The problem is that the thread may check the config
	while it was notify to stop.

Fix description:
	synchronize the plugin close function (referint_postop_close)
	and the batch thread (referint_thread_func).
	When the batch thread starts it set 'batch_thread_running'
	and reset it when it stops.
	The plugin close function notifes the batch thread to stop
	(via keeprunning==0) and then wait 'batch_thread_running' is
	reset

relates: 389ds#6080

Reviewed by: Pierre Rogier (thanks !)
@tbordaz tbordaz merged commit 72c211b into 389ds:main Mar 18, 2024
tbordaz added a commit that referenced this pull request Mar 18, 2024
Bug description:
	Referential integrity plugin spawn a thread to run
	integrity check/update in a deferred way. It uses a log
	file to pipe changes to check. The name of the file,
	stored in the config, is read periodically.
	At shutdown, referint plugin close callback notifies
	the thread to stop and free the config.
	The problem is that the thread may check the config
	while it was notify to stop.

Fix description:
	synchronize the plugin close function (referint_postop_close)
	and the batch thread (referint_thread_func).
	When the batch thread starts it set 'batch_thread_running'
	and reset it when it stops.
	The plugin close function notifes the batch thread to stop
	(via keeprunning==0) and then wait 'batch_thread_running' is
	reset

relates: #6080

Reviewed by: Pierre Rogier (thanks !)
tbordaz added a commit that referenced this pull request Mar 18, 2024
Bug description:
	Referential integrity plugin spawn a thread to run
	integrity check/update in a deferred way. It uses a log
	file to pipe changes to check. The name of the file,
	stored in the config, is read periodically.
	At shutdown, referint plugin close callback notifies
	the thread to stop and free the config.
	The problem is that the thread may check the config
	while it was notify to stop.

Fix description:
	synchronize the plugin close function (referint_postop_close)
	and the batch thread (referint_thread_func).
	When the batch thread starts it set 'batch_thread_running'
	and reset it when it stops.
	The plugin close function notifes the batch thread to stop
	(via keeprunning==0) and then wait 'batch_thread_running' is
	reset

relates: #6080

Reviewed by: Pierre Rogier (thanks !)
tbordaz added a commit that referenced this pull request Mar 18, 2024
Bug description:
	Referential integrity plugin spawn a thread to run
	integrity check/update in a deferred way. It uses a log
	file to pipe changes to check. The name of the file,
	stored in the config, is read periodically.
	At shutdown, referint plugin close callback notifies
	the thread to stop and free the config.
	The problem is that the thread may check the config
	while it was notify to stop.

Fix description:
	synchronize the plugin close function (referint_postop_close)
	and the batch thread (referint_thread_func).
	When the batch thread starts it set 'batch_thread_running'
	and reset it when it stops.
	The plugin close function notifes the batch thread to stop
	(via keeprunning==0) and then wait 'batch_thread_running' is
	reset

relates: #6080

Reviewed by: Pierre Rogier (thanks !)
tbordaz added a commit that referenced this pull request Mar 18, 2024
Bug description:
	Referential integrity plugin spawn a thread to run
	integrity check/update in a deferred way. It uses a log
	file to pipe changes to check. The name of the file,
	stored in the config, is read periodically.
	At shutdown, referint plugin close callback notifies
	the thread to stop and free the config.
	The problem is that the thread may check the config
	while it was notify to stop.

Fix description:
	synchronize the plugin close function (referint_postop_close)
	and the batch thread (referint_thread_func).
	When the batch thread starts it set 'batch_thread_running'
	and reset it when it stops.
	The plugin close function notifes the batch thread to stop
	(via keeprunning==0) and then wait 'batch_thread_running' is
	reset

relates: #6080

Reviewed by: Pierre Rogier (thanks !)
tbordaz added a commit that referenced this pull request Mar 18, 2024
Bug description:
	Referential integrity plugin spawn a thread to run
	integrity check/update in a deferred way. It uses a log
	file to pipe changes to check. The name of the file,
	stored in the config, is read periodically.
	At shutdown, referint plugin close callback notifies
	the thread to stop and free the config.
	The problem is that the thread may check the config
	while it was notify to stop.

Fix description:
	synchronize the plugin close function (referint_postop_close)
	and the batch thread (referint_thread_func).
	When the batch thread starts it set 'batch_thread_running'
	and reset it when it stops.
	The plugin close function notifes the batch thread to stop
	(via keeprunning==0) and then wait 'batch_thread_running' is
	reset

relates: #6080

Reviewed by: Pierre Rogier (thanks !)
tbordaz added a commit that referenced this pull request Mar 18, 2024
Bug description:
	Referential integrity plugin spawn a thread to run
	integrity check/update in a deferred way. It uses a log
	file to pipe changes to check. The name of the file,
	stored in the config, is read periodically.
	At shutdown, referint plugin close callback notifies
	the thread to stop and free the config.
	The problem is that the thread may check the config
	while it was notify to stop.

Fix description:
	synchronize the plugin close function (referint_postop_close)
	and the batch thread (referint_thread_func).
	When the batch thread starts it set 'batch_thread_running'
	and reset it when it stops.
	The plugin close function notifes the batch thread to stop
	(via keeprunning==0) and then wait 'batch_thread_running' is
	reset

relates: #6080

Reviewed by: Pierre Rogier (thanks !)
tbordaz added a commit that referenced this pull request Mar 18, 2024
Bug description:
	Referential integrity plugin spawn a thread to run
	integrity check/update in a deferred way. It uses a log
	file to pipe changes to check. The name of the file,
	stored in the config, is read periodically.
	At shutdown, referint plugin close callback notifies
	the thread to stop and free the config.
	The problem is that the thread may check the config
	while it was notify to stop.

Fix description:
	synchronize the plugin close function (referint_postop_close)
	and the batch thread (referint_thread_func).
	When the batch thread starts it set 'batch_thread_running'
	and reset it when it stops.
	The plugin close function notifes the batch thread to stop
	(via keeprunning==0) and then wait 'batch_thread_running' is
	reset

relates: #6080

Reviewed by: Pierre Rogier (thanks !)
tbordaz added a commit that referenced this pull request Mar 18, 2024
Bug description:
	Referential integrity plugin spawn a thread to run
	integrity check/update in a deferred way. It uses a log
	file to pipe changes to check. The name of the file,
	stored in the config, is read periodically.
	At shutdown, referint plugin close callback notifies
	the thread to stop and free the config.
	The problem is that the thread may check the config
	while it was notify to stop.

Fix description:
	synchronize the plugin close function (referint_postop_close)
	and the batch thread (referint_thread_func).
	When the batch thread starts it set 'batch_thread_running'
	and reset it when it stops.
	The plugin close function notifes the batch thread to stop
	(via keeprunning==0) and then wait 'batch_thread_running' is
	reset

relates: #6080

Reviewed by: Pierre Rogier (thanks !)
tbordaz added a commit that referenced this pull request Mar 18, 2024
Bug description:
	Referential integrity plugin spawn a thread to run
	integrity check/update in a deferred way. It uses a log
	file to pipe changes to check. The name of the file,
	stored in the config, is read periodically.
	At shutdown, referint plugin close callback notifies
	the thread to stop and free the config.
	The problem is that the thread may check the config
	while it was notify to stop.

Fix description:
	synchronize the plugin close function (referint_postop_close)
	and the batch thread (referint_thread_func).
	When the batch thread starts it set 'batch_thread_running'
	and reset it when it stops.
	The plugin close function notifes the batch thread to stop
	(via keeprunning==0) and then wait 'batch_thread_running' is
	reset

relates: #6080

Reviewed by: Pierre Rogier (thanks !)
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