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

Don't self-initialize schema comments #2038

Merged
merged 1 commit into from
Sep 15, 2023
Merged

Don't self-initialize schema comments #2038

merged 1 commit into from
Sep 15, 2023

Conversation

benjaminwinger
Copy link
Collaborator

I was getting tons of segfaults on my computer when running tests. It turned out that the new comment field in the TableSchema is being initialized to itself in one of the constructors.

Is the comment supposed to be passed as an argument to this constructor? I just default-initialized it instead, which fixed the crashes.

@Riolku
Copy link
Contributor

Riolku commented Sep 15, 2023

Yikes. Sorry about that, any reason why our tests don't catch this?

Is the comment supposed to be passed as an argument to this constructor?

Not this one. By default the comment is supposed to be empty, but the second constructor is used as a "more complete" one, for copying, AFAICT.

@benjaminwinger
Copy link
Collaborator Author

It was only happening in release mode, I had to compile with the RelWithDebInfo configuration to debug it (which turned a dozen or so crashes into every single database test crashing immediately). So it might vary with the compiler: I think CI is using gcc 11, while I'm building with gcc 13.

A quick test in godbolt shows that it produces a segfault on gcc 12+, and succeeds on gcc <11. It also works fine in clang, which is the only one to produce a warning.

@codecov
Copy link

codecov bot commented Sep 15, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: -0.01% ⚠️

Comparison is base (4514dd4) 90.14% compared to head (d60da3b) 90.14%.
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2038      +/-   ##
==========================================
- Coverage   90.14%   90.14%   -0.01%     
==========================================
  Files         934      938       +4     
  Lines       33365    33364       -1     
==========================================
- Hits        30077    30076       -1     
  Misses       3288     3288              
Files Changed Coverage Δ
src/include/catalog/table_schema.h 100.00% <100.00%> (ø)

... and 43 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Riolku
Copy link
Contributor

Riolku commented Sep 15, 2023

Yet another reason to use clang 😉

@benjaminwinger
Copy link
Collaborator Author

Except there are so many warnings in the codebase that you wouldn't notice with clang normally. If we could clean up all the warnings and turn them into errors, then it could have been caught by the clang CI.

@Riolku
Copy link
Contributor

Riolku commented Sep 15, 2023

ANTLR4 is particularly loud. I might look into reducing our warnings, ive always liked Werror

@Riolku Riolku mentioned this pull request Sep 15, 2023
4 tasks
@benjaminwinger benjaminwinger merged commit 49850c8 into master Sep 15, 2023
10 checks passed
@benjaminwinger benjaminwinger deleted the comment-fix branch September 15, 2023 16:34
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.

None yet

3 participants