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

fix: Fix BinningValue conversions #2333

Merged

Conversation

andiwand
Copy link
Contributor

In the ATLAS debug build, we're getting failures in the ActsEventCnv test:

ActsTrackingGeometrySvc                             FATAL in sysInitialize(): standard std::exception is caught
ActsTrackingGeometrySvc                             ERROR [json.exception.type_error.302] type must be number, but is string
ServiceManager                                      ERROR Unable to initialize service "ActsTrackingGeometrySvc"

This is because some compilation units in Plugins/Json try to convert a BinningValue without including the header UtilitiesJsonConverter.hpp which has the NLOHMANN_JSON_SERIALIZE_ENUM declaration for BinningValue. Thus, the conversion can work differently depending on the compilation unit, and the behavior can also depend on what gets inlined, so can differ between the optimized and debug build.

fixes #2331

In the ATLAS debug build, we're getting failures in the ActsEventCnv test:

```
ActsTrackingGeometrySvc                             FATAL in sysInitialize(): standard std::exception is caught
ActsTrackingGeometrySvc                             ERROR [json.exception.type_error.302] type must be number, but is string
ServiceManager                                      ERROR Unable to initialize service "ActsTrackingGeometrySvc"
```

This is because some compilation units in Plugins/Json try to convert
a BinningValue without including the header UtilitiesJsonConverter.hpp
which has the NLOHMANN_JSON_SERIALIZE_ENUM declaration for BinningValue.
Thus, the conversion can work differently depending on the compilation unit,
and the behavior can also depend on what gets inlined, so can differ
between the optimized and debug build.

This change adds the missing #includes and should fix this failure.
@andiwand andiwand added this to the next milestone Jul 29, 2023
@github-actions github-actions bot added the Component - Plugins Affects one or more Plugins label Jul 29, 2023
@andiwand andiwand changed the title fix: Fix BinningValue conversions. fix: Fix BinningValue conversions Jul 29, 2023
@codecov
Copy link

codecov bot commented Jul 29, 2023

Codecov Report

Merging #2333 (5b4bc27) into main (4bc20bf) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main    #2333   +/-   ##
=======================================
  Coverage   49.67%   49.67%           
=======================================
  Files         453      453           
  Lines       25524    25524           
  Branches    11701    11701           
=======================================
  Hits        12678    12678           
  Misses       4571     4571           
  Partials     8275     8275           

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@github-actions
Copy link

github-actions bot commented Jul 29, 2023

📊 Physics performance monitoring for 5b4bc27

Summary
Full report
Seeding: seeded, truth estimated, orthogonal
CKF: seeded, truth smeared, truth estimated, orthogonal
IVF: seeded, truth smeared, truth estimated, orthogonal
AMVF: seeded, truth smeared, truth estimated, orthogonal
Ambiguity resolution: seeded, orthogonal
Truth tracking
Truth tracking (GSF)

Vertexing

Vertexing vs. mu
IVF seeded

IVF truth_smeared

IVF truth_estimated

IVF orthogonal

AMVF seeded

AMVF truth_smeared

AMVF truth_estimated

AMVF orthogonal

Seeding

Seeding seeded

Seeding truth_estimated

Seeding orthogonal

CKF

CKF seeded

CKF truth_smeared

CKF truth_estimated

CKF orthogonal

Ambiguity resolution

seeded

Truth tracking (Kalman Filter)

Truth tracking

Truth tracking (GSF)

Truth tracking

@kodiakhq kodiakhq bot merged commit d85d3fd into acts-project:main Jul 30, 2023
57 checks passed
@andiwand andiwand deleted the snyder-fix-binningvalue-conversions branch July 30, 2023 07:46
@acts-project-service acts-project-service added the Fails Athena tests This PR causes a failure in the Athena tests label Jul 30, 2023
@paulgessinger paulgessinger modified the milestones: next, v28.1.0 Aug 7, 2023
@paulgessinger
Copy link
Member

Pretty sure the output changes are not related.

@paulgessinger paulgessinger removed the Fails Athena tests This PR causes a failure in the Athena tests label Aug 7, 2023
kodiakhq bot pushed a commit that referenced this pull request Apr 26, 2024
Since we had the same enum conversion problem a second time I propose to disable the default enum serialization via `JSON_DISABLE_ENUM_SERIALIZATION`.

This results in a compile error instead of runtime errors when we actually try to read strings as integers.

I set the flag `PRIVATE` in cmake so it does not sneak into user codebases but the user might face the same problems if the includes are not done correctly.

Not having the enum and the `NLOHMANN_JSON_SERIALIZE_ENUM` in the same place results in these kind of issues. I wonder if we should rather bring them together and use preprocessor flags. That would also guarantee that the right conversion function will be visible all the time.

References:
 - https://json.nlohmann.me/api/macros/json_disable_enum_serialization/
 - https://json.nlohmann.me/api/macros/nlohmann_json_serialize_enum/

Related PRs and issues:
 - #3142
 - #2333
 - #2331
EleniXoch pushed a commit to EleniXoch/acts that referenced this pull request May 6, 2024
)

Since we had the same enum conversion problem a second time I propose to disable the default enum serialization via `JSON_DISABLE_ENUM_SERIALIZATION`.

This results in a compile error instead of runtime errors when we actually try to read strings as integers.

I set the flag `PRIVATE` in cmake so it does not sneak into user codebases but the user might face the same problems if the includes are not done correctly.

Not having the enum and the `NLOHMANN_JSON_SERIALIZE_ENUM` in the same place results in these kind of issues. I wonder if we should rather bring them together and use preprocessor flags. That would also guarantee that the right conversion function will be visible all the time.

References:
 - https://json.nlohmann.me/api/macros/json_disable_enum_serialization/
 - https://json.nlohmann.me/api/macros/nlohmann_json_serialize_enum/

Related PRs and issues:
 - acts-project#3142
 - acts-project#2333
 - acts-project#2331
asalzburger pushed a commit to asalzburger/acts that referenced this pull request May 21, 2024
)

Since we had the same enum conversion problem a second time I propose to disable the default enum serialization via `JSON_DISABLE_ENUM_SERIALIZATION`.

This results in a compile error instead of runtime errors when we actually try to read strings as integers.

I set the flag `PRIVATE` in cmake so it does not sneak into user codebases but the user might face the same problems if the includes are not done correctly.

Not having the enum and the `NLOHMANN_JSON_SERIALIZE_ENUM` in the same place results in these kind of issues. I wonder if we should rather bring them together and use preprocessor flags. That would also guarantee that the right conversion function will be visible all the time.

References:
 - https://json.nlohmann.me/api/macros/json_disable_enum_serialization/
 - https://json.nlohmann.me/api/macros/nlohmann_json_serialize_enum/

Related PRs and issues:
 - acts-project#3142
 - acts-project#2333
 - acts-project#2331
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component - Plugins Affects one or more Plugins
Projects
None yet
Development

Successfully merging this pull request may close these issues.

JSON read failure in ATLAS debug build
4 participants