Sitelet https://web.archive.org/web/20200530184441/https://github.com/apple/turicreate/issues/3052
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

block_cache has dependency crash #3052

Open
guihao-liang opened this issue Mar 16, 2020 · 0 comments
Open

block_cache has dependency crash #3052

guihao-liang opened this issue Mar 16, 2020 · 0 comments

Comments

@guihao-liang
Copy link
Collaborator

@guihao-liang guihao-liang commented Mar 16, 2020

unity_sframe cannot be used alone in a pure C++ routine when pulling data from the remote system (S3). unity_sframe should be able to be used as a pure C++ library, which it's it is the original usage.

repro

#include <iostream>
#include <core/storage/fileio/s3_filesys.hpp>
#include <core/storage/fileio/general_fstream.hpp>
#include <core/storage/fileio/fixed_size_cache_manager.hpp>
#include <core/storage/serialization/dir_archive.hpp>
#include <core/storage/sframe_interface/unity_sframe.hpp>
#include <core/logging/logger.hpp>
#include <core/logging/assertions.hpp>
#include <core/globals/globals.hpp>

/**
 * Test the general_fstream.
 * This program will read from the file_url, writes "hello world" to the stream,
 * read from it and check contents are equal.
 */
int main(int argc, char** argv) {
  std::string url_read(
      "s3://"
// credentials
      "integration/manual/sframes/big_sframe_od/");

  global_logger().set_log_level(LOG_DEBUG);
  __attribute__((unused)) auto& gui = turi::fileio::s3::turi_global_AWS_SDK_setup();
  turi::globals::initialize_globals_from_environment(".");
  try {
    turi::unity_sframe sf;
    sf.construct_from_sframe_index(url_read);

    sf.begin_iterator();
    auto ret = sf.iterator_get_next(1);
    std::cout << ret.size() << std::endl;
    sf.save_frame("./gui");

  } catch(std::string& e) {
    std::cerr << "Exception: " << e << std::endl;
  } catch(std::exception& e) {
    std::cerr << "Exception: " << e.what() << std::endl;
  }

  return 0;
}

The root cause is that the file_handle singleton is destructed before block_cahe,

1584239579 : ERROR:    mutex.hpp(operator():68): Check failed: !error:
ERROR:    mutex.hpp(operator():68): Mutex lock error 22
1584239579 : ERROR:    mutex.hpp(operator():68): Check failed: !error:
ERROR:    mutex.hpp(operator():68): Mutex lock error 22
1584239579 : ERROR:    mutex.hpp(operator():68): Check failed: !error:
ERROR:    mutex.hpp(operator():68): Mutex lock error 22
1584239579 : ERROR:    mutex.hpp(operator():68): Check failed: !error:
ERROR:    mutex.hpp(operator():68): Mutex lock error 22
1584239579 : ERROR:    mutex.hpp(operator():68): Check failed: !error:
ERROR:    mutex.hpp(operator():68): Mutex lock error 22

Possible Solution

Similar to #3042, use dependency injection to avoid this error.

Further, we should have something to this

auto api = turi::initAPI(options);
...
turi::shutDown(api);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.