Uploaded image for project: 'Apache Arrow'
  1. Apache Arrow
  2. ARROW-15881

[c++] When link to libavrocpp.so, call parquet::arrow::WriteTable in a child thread get segmentation fault

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Not A Bug
    • 7.0.0
    • None
    • C++
    • CentOS7,gcc7.0+,C++17 or C++11

    Description

      I resolve this problem. I use rpm package to install arrow before. After I build arrow from source code (use same gcc I build avro) and install, there is no segmentation fault. 

      ----------------------------------------------------------------------------------------------

      When I try to use Arrow to write parquet files, I encounter a error. The parquet::arrow::WriteTable out child thread can call successful, but  parquet::arrow::WriteTable in child thread while cause Segmentation fault.

      In my CMakeList.txt,I link libavrocpp.so because I want to use avro in project after finish this test. And I find that if I remove the link of libavrocpp.so, code while run successful.

      The code like this:

      arrow::Int64Builder test_a;
      for (int i = 0; i < 1e7; ++i) {
        PARQUET_THROW_NOT_OK(test_a.Append(i));
      }
      auto sc = arrow::schema({arrow::field("A", arrow::int64())});
      auto table = arrow::Table::Make(sc,{test_a.Finish().ValueOrDie()});
      const string &fileid = sole::uuid4().str();
      string filename = "test.parq";
      try {
        std::shared_ptr<arrow::io::FileOutputStream> outfile;
        PARQUET_ASSIGN_OR_THROW(
                outfile,arrow::io::FileOutputStream::Open(filename)
        );
        PARQUET_THROW_NOT_OK(
                parquet::arrow::WriteTable(*table, arrow::default_memory_pool(), outfile, table->num_rows())
        );
      } catch (exception &ex) {
        cout << ex.what() << endl;
      }
      shared_ptr<std::thread> thread = make_shared<std::thread>([=]() {
          arrow::Int64Builder test_a;
            for (int i = 0; i < 1e7; ++i) {
              PARQUET_THROW_NOT_OK(test_a.Append(i));
          }
          auto sc = arrow::schema({arrow::field("A", arrow::int64())});
          auto table = arrow::Table::Make(sc,{test_a.Finish().ValueOrDie()});
          const string &fileid = sole::uuid4().str();
          string filename = "test.parq";
          try {
              std::shared_ptr<arrow::io::FileOutputStream> outfile;
              PARQUET_ASSIGN_OR_THROW(
                      outfile,arrow::io::FileOutputStream::Open(filename)
              );
              PARQUET_THROW_NOT_OK(
                      parquet::arrow::WriteTable(*table, arrow::default_memory_pool(), outfile, table->num_rows())
              );
          } catch (exception &ex) {
              cout << ex.what() << endl;
          }
      };
      thread->join();
      return 0;
      
      

       

      The stack message is in the picture in attachment.

       

      Attachments

        1. message.png
          39 kB
          zzh

        Activity

          People

            Unassigned Unassigned
            typeryougishiki zzh
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: