Skip to content

ARROW-15550: [C++] Add optional debug memory checks#12330

Closed
pitrou wants to merge 3 commits intoapache:masterfrom
pitrou:ARROW-15550-debug-memory-checks
Closed

ARROW-15550: [C++] Add optional debug memory checks#12330
pitrou wants to merge 3 commits intoapache:masterfrom
pitrou:ARROW-15550-debug-memory-checks

Conversation

@pitrou
Copy link
Copy Markdown
Member

@pitrou pitrou commented Feb 3, 2022

Debug memory checks can be enabled by setting the environment variable ARROW_DEBUG_MEMORY_POOL
to one of the recognized values "abort", "trap" or "warn" (regardless of whether Arrow
was compiled in debug or release mode).

The only implemented check adds a suffix past the allocation and checks that it isn't clobbered on deallocation.
Adding a prefix would be more expensive because of alignment constraints.

Also add a fix by Will Jones for ARROW-14047 (Parquet Arrow reader sets null values in buffer overflow), since otherwise CI would fail.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Feb 3, 2022

@github-actions
Copy link
Copy Markdown

github-actions bot commented Feb 3, 2022

⚠️ Ticket has not been started in JIRA, please click 'Start Progress'.

Debug memory checks can be enabled by setting the environment variable ARROW_DEBUG_MEMORY_POOL
to one of the recognized values "abort", "trap" or "warn" (regardless of whether Arrow
was compiled in debug or release mode).

The only implemented check adds a suffix past the allocation and checks that it isn't clobbered on deallocation.
Adding a prefix would be more expensive because of alignment constraints.
@pitrou pitrou force-pushed the ARROW-15550-debug-memory-checks branch from 27f10c8 to 5af811f Compare February 8, 2022 15:14
@pitrou
Copy link
Copy Markdown
Member Author

pitrou commented Feb 8, 2022

@github-actions crossbow submit -g cpp

@github-actions
Copy link
Copy Markdown

github-actions bot commented Feb 8, 2022

Revision: 5af811f

Submitted crossbow builds: ursacomputing/crossbow @ actions-1606

Task Status
test-build-cpp-fuzz Github Actions
test-conda-cpp Github Actions
test-conda-cpp-valgrind Azure
test-debian-10-cpp-amd64 Github Actions
test-debian-10-cpp-i386 Github Actions
test-debian-11-cpp-amd64 Github Actions
test-debian-11-cpp-i386 Github Actions
test-fedora-33-cpp Github Actions
test-ubuntu-18.04-cpp Github Actions
test-ubuntu-18.04-cpp-release Github Actions
test-ubuntu-18.04-cpp-static Github Actions
test-ubuntu-20.04-cpp Github Actions
test-ubuntu-20.04-cpp-14 Github Actions
test-ubuntu-20.04-cpp-17 Github Actions
test-ubuntu-20.04-cpp-bundled Github Actions
test-ubuntu-20.04-cpp-thread-sanitizer Github Actions
test-ubuntu-21.04-cpp Github Actions

@pitrou
Copy link
Copy Markdown
Member Author

pitrou commented Feb 8, 2022

@github-actions crossbow submit -g cpp

@github-actions
Copy link
Copy Markdown

github-actions bot commented Feb 8, 2022

Revision: 689076851345a919a3654bd6a129dd3c3909b40f

Submitted crossbow builds: ursacomputing/crossbow @ actions-1607

Task Status
test-build-cpp-fuzz Github Actions
test-conda-cpp Github Actions
test-conda-cpp-valgrind Azure
test-debian-10-cpp-amd64 Github Actions
test-debian-10-cpp-i386 Github Actions
test-debian-11-cpp-amd64 Github Actions
test-debian-11-cpp-i386 Github Actions
test-fedora-33-cpp Github Actions
test-ubuntu-18.04-cpp Github Actions
test-ubuntu-18.04-cpp-release Github Actions
test-ubuntu-18.04-cpp-static Github Actions
test-ubuntu-20.04-cpp Github Actions
test-ubuntu-20.04-cpp-14 Github Actions
test-ubuntu-20.04-cpp-17 Github Actions
test-ubuntu-20.04-cpp-bundled Github Actions
test-ubuntu-20.04-cpp-thread-sanitizer Github Actions
test-ubuntu-21.04-cpp Github Actions

@pitrou pitrou force-pushed the ARROW-15550-debug-memory-checks branch from 6890768 to 5c5fe4f Compare February 8, 2022 17:24
@pitrou pitrou force-pushed the ARROW-15550-debug-memory-checks branch from 5c5fe4f to 9090492 Compare February 8, 2022 17:47
@pitrou
Copy link
Copy Markdown
Member Author

pitrou commented Feb 8, 2022

@github-actions crossbow submit -g cpp

@pitrou pitrou marked this pull request as ready for review February 8, 2022 18:18
@pitrou pitrou requested a review from lidavidm February 8, 2022 18:19
@github-actions
Copy link
Copy Markdown

github-actions bot commented Feb 8, 2022

Revision: 9090492

Submitted crossbow builds: ursacomputing/crossbow @ actions-1608

Task Status
test-build-cpp-fuzz Github Actions
test-conda-cpp Github Actions
test-conda-cpp-valgrind Azure
test-debian-10-cpp-amd64 Github Actions
test-debian-10-cpp-i386 Github Actions
test-debian-11-cpp-amd64 Github Actions
test-debian-11-cpp-i386 Github Actions
test-fedora-33-cpp Github Actions
test-ubuntu-18.04-cpp Github Actions
test-ubuntu-18.04-cpp-release Github Actions
test-ubuntu-18.04-cpp-static Github Actions
test-ubuntu-20.04-cpp Github Actions
test-ubuntu-20.04-cpp-14 Github Actions
test-ubuntu-20.04-cpp-17 Github Actions
test-ubuntu-20.04-cpp-bundled Github Actions
test-ubuntu-20.04-cpp-thread-sanitizer Github Actions
test-ubuntu-21.04-cpp Github Actions

Copy link
Copy Markdown
Member

@wjones127 wjones127 left a comment

Choose a reason for hiding this comment

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

This looks great! GDB integration sounds cool (though I haven't tried it out yet).

Run a piece of code making an invalid memory write with the
ARROW_DEBUG_MEMORY_POOL environment variable set to a specific value.
"""
code = f"""if 1:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

is the if 1 just so the string contents don't have to be dedented?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes!

@lidavidm
Copy link
Copy Markdown
Member

lidavidm commented Feb 8, 2022

It looks like conda-cpp-valgrind failed, but there's not an obvious error (out of memory, or compiler crash?). It doesn't seem related to this, though.

@pitrou
Copy link
Copy Markdown
Member Author

pitrou commented Feb 9, 2022

Yes, the conda-cpp-valgrind failure is https://issues.apache.org/jira/browse/ARROW-15354

@pitrou pitrou closed this in d6e5778 Feb 9, 2022
@pitrou pitrou deleted the ARROW-15550-debug-memory-checks branch February 9, 2022 08:44
@ursabot
Copy link
Copy Markdown

ursabot commented Feb 9, 2022

Benchmark runs are scheduled for baseline = f0ed940 and contender = d6e5778. d6e5778 is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
Conbench compare runs links:
[Finished ⬇️0.0% ⬆️0.0%] ec2-t3-xlarge-us-east-2
[Finished ⬇️1.88% ⬆️0.09%] test-mac-arm
[Finished ⬇️0.0% ⬆️0.0%] ursa-i9-9960x
[Finished ⬇️0.61% ⬆️0.0%] ursa-thinkcentre-m75q
Supported benchmarks:
ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python. Runs only benchmarks with cloud = True
test-mac-arm: Supported benchmark langs: C++, Python, R
ursa-i9-9960x: Supported benchmark langs: Python, R, JavaScript
ursa-thinkcentre-m75q: Supported benchmark langs: C++, Java

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants