Skip to content
This repository has been archived by the owner on Oct 26, 2021. It is now read-only.

Partial revert of 3b28999fa9a1f7f8cd9b55ba6f8165e2447038fc #7

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

Partial revert of 3b28999fa9a1f7f8cd9b55ba6f8165e2447038fc #7

wants to merge 1 commit into from

Conversation

martin-ejdestig
Copy link
Contributor

@martin-ejdestig martin-ejdestig commented Jul 15, 2019

Revert "Added library constructor/destructor to call DLT_REGISTER_CONTEXT/DLT_UNREGISTER_CONTEXT" part. Originally made in src/key-value-store and copied to src/sqlite so revert change there as well.

Calling DLT_REGISTER_CONTEXT in a constructor function is problematic because:

  • DLT documentation specifically mentions in multiple places that DLT_REGISTER_CONTEXT must not be called before DLT_REGISTER_APP. Unclear what the consequences are if this is done.

  • Services that fork() can not use DLT even if they themselves are careful not to perform any calls to DLT until after fork(). This is supported and specifically tested for in DLT. DLT_REGISTER_CONTEXT from constructor function will call dlt_init(), that monitors for fork() with pthread_atfork(), in wrong process. End result is that nothing is ever sent from the main daemon process to the DLT daemon.

Have verified that DLT logging in persistence-administrator does not work without this patch but works with it applied.

martin-ejdestig added a commit to Pelagicore/meta-pelux that referenced this pull request Jul 15, 2019
In applications that link against persistence-common-object. See commit
message in patch for details.

Upstream pr: GENIVI/persistence-common-object#7

Signed-off-by: Martin Ejdestig <[email protected]>
@gunnarx
Copy link
Member

gunnarx commented Jul 19, 2019

  1. I think the commit comment could be a bit better. Do include the reference to reverting 3b28999 in the body
    but a better summary might say something like:
    (5b0d979)
    DB backends: Do not DLT_REGISTER_CONTEXT in library init

  2. EDIT: Sorry, my bad. I got confused by all the references GitHub is putting everywhere.

@gunnarx
Copy link
Member

gunnarx commented Jul 22, 2019

@martin-ejdestig Looks like this is a necessary change based on your testing and I'm inclined to merge (in lieu of an active maintainer). Would you consider changing the commit message as proposed (or will it cause issues in your downstream (meta-pelux)).

Partial revert of 3b28999. Specifically
the "Added library constructor/destructor to call
DLT_REGISTER_CONTEXT/DLT_UNREGISTER_CONTEXT" part. Originally made in
src/key-value-store and copied to src/sqlite so revert change there as
well.

Calling DLT_REGISTER_CONTEXT in a constructor function is problematic
because:

- DLT documentation specifically mentions in multiple places that
  DLT_REGISTER_CONTEXT must not be called before DLT_REGISTER_APP. Unclear
  what the consequences are if this is done. DLT_REGISTER_APP in main() or
  a function called from main() will be invoked after constructor
  functions.

- Services that fork() can not use DLT even if they themselves are careful
  not to perform any calls to DLT until after fork(). This is supported and
  specifically tested for in DLT. DLT_REGISTER_CONTEXT from constructor
  function will call dlt_init(), that monitors for fork() with
  pthread_atfork(), in wrong process. End result is that nothing is ever
  sent from the main daemon process to the DLT daemon.

Have verified that DLT logging in persistence-administrator, that currently
daemonizes by calling fork() at startup, does not work without this patch
but works with it applied.

Signed-off-by: Martin Ejdestig <[email protected]>
@martin-ejdestig
Copy link
Contributor Author

Updated commit message.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants