-
Notifications
You must be signed in to change notification settings - Fork 4.1k
GH-49272: [C++][CI] Fix intermittent segfault in arrow-json-test with MinGW #49462
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
base: main
Are you sure you want to change the base?
Changes from all commits
1e0fba3
5c5a5e8
de67523
41da5b0
43bdf77
fbbc431
713faf9
81f74cb
b353c42
a4e906f
e44cc5f
5817aca
cc7e6cd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -290,6 +290,39 @@ TEST(ReaderTest, MultipleChunksParallel) { | |
| AssertTablesEqual(*serial, *threaded); | ||
| } | ||
|
|
||
| // Regression test for intermittent threading crashes on MinGW. | ||
| // Run this test multiple times manually to stress-test: | ||
| // while build/debug/arrow-json-test \ | ||
| // --gtest_filter=ReaderTest.MultipleChunksParallelRegression; do :; done | ||
| // See https://github.com/apache/arrow/issues/49272 | ||
|
|
||
| // Helper used by multiple-chunk parallel tests to build the JSON input, | ||
| // configure read options and read the resulting table. | ||
| static Result<std::shared_ptr<Table>> ReadMultipleChunksParallelTable( | ||
| int64_t count, bool use_threads, const ParseOptions& parse_options) { | ||
| ReadOptions read_options; | ||
| read_options.block_size = static_cast<int>(count / 2); | ||
| read_options.use_threads = use_threads; | ||
|
|
||
| std::string json; | ||
| json.reserve(static_cast<size_t>(count) * 16); // rough reserve to avoid reallocations | ||
| for (int64_t i = 0; i < count; ++i) { | ||
| json += "{\"a\":" + std::to_string(i) + "}\n"; | ||
| } | ||
|
|
||
| return ReadToTable(std::move(json), read_options, parse_options); | ||
| } | ||
|
|
||
| TEST(ReaderTest, MultipleChunksParallelRegression) { | ||
| int64_t count = 1 << 10; | ||
| ParseOptions parse_options; | ||
| parse_options.unexpected_field_behavior = UnexpectedFieldBehavior::InferType; | ||
|
|
||
| ASSERT_OK_AND_ASSIGN(auto table, ReadMultipleChunksParallelTable( | ||
| count, /*use_threads=*/true, parse_options)); | ||
| ASSERT_EQ(table->num_rows(), count); | ||
|
Comment on lines
+316
to
+323
|
||
| } | ||
|
|
||
| TEST(ReaderTest, ListArrayWithFewValues) { | ||
| // ARROW-7647 | ||
| ParseOptions parse_options; | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -44,6 +44,7 @@ | |||||||||||
| #include "arrow/util/macros.h" | ||||||||||||
| #include "arrow/util/test_common.h" | ||||||||||||
| #include "arrow/util/thread_pool.h" | ||||||||||||
| #include "arrow/util/windows_compatibility.h" | ||||||||||||
|
|
||||||||||||
| namespace arrow { | ||||||||||||
| namespace internal { | ||||||||||||
|
|
@@ -660,6 +661,34 @@ TEST_F(TestThreadPool, OwnsCurrentThread) { | |||||||||||
| ASSERT_FALSE(one_failed); | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| #ifdef _WIN32 | ||||||||||||
| TEST_F(TestThreadPool, OwnsThisThreadPreservesLastError) { | ||||||||||||
| # ifndef ARROW_ENABLE_THREADING | ||||||||||||
| GTEST_SKIP() << "Test requires threading support"; | ||||||||||||
| # endif | ||||||||||||
| auto pool = this->MakeThreadPool(4); | ||||||||||||
|
|
||||||||||||
| // Verify from outside the pool: OwnsThisThread() must not clobber | ||||||||||||
| // the calling thread's last-error state. | ||||||||||||
| ::SetLastError(ERROR_FILE_NOT_FOUND); | ||||||||||||
| ASSERT_FALSE(pool->OwnsThisThread()); | ||||||||||||
| ASSERT_EQ(::GetLastError(), static_cast<DWORD>(ERROR_FILE_NOT_FOUND)); | ||||||||||||
|
|
||||||||||||
| // Verify from inside a pool thread. | ||||||||||||
| std::atomic<bool> error_preserved{true}; | ||||||||||||
| ASSERT_OK(pool->Spawn([&] { | ||||||||||||
| ::SetLastError(ERROR_ACCESS_DENIED); | ||||||||||||
| ASSERT_TRUE(pool->OwnsThisThread()); | ||||||||||||
|
||||||||||||
| ASSERT_TRUE(pool->OwnsThisThread()); | |
| if (!pool->OwnsThisThread()) { | |
| error_preserved = false; | |
| return; | |
| } |
Uh oh!
There was an error while loading. Please reload this page.