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

Reading from memfs file is not thread safe #159

Open
omohokcoj opened this issue Jun 9, 2021 · 0 comments
Open

Reading from memfs file is not thread safe #159

omohokcoj opened this issue Jun 9, 2021 · 0 comments

Comments

@omohokcoj
Copy link

File content is inconsistent when reading a file from memfs simultaneously in multiple threads:

10.times { Thread.new { JSON.parse(File.read("/__enclose_io_memfs__/lib/ruby/gems/2.7.0/gems/motor-admin-0.1.56/ui/dist/manifest.json")) } }
/__enclose_io_memfs__/lib/ruby/2.7.0/json/common.rb:156:in `parse': 783: unexpected token at '.svg": "icons/zoom-money.svg", (JSON::ParserError)
  "zoom-out.svg": "icons/zoom-out.svg",
  "zoom-question.svg": "icons/zoom-question.svg"
}.svg": "icons/zoom-money.svg",
  "zoom-out.svg": "icons/zoom-out.svg",
  "zoom-question.svg": "icons/zoom-question.svg"
}int.svg",
  "accessible.svg": "icons/accessible.svg",
  "activity.svg": "icons/activity.svg",
  "ad.svg": "icons/ad.svg",
  "adjustments-alt.svg": "icons/adjustments-alt.svg",
  "adjustments-horizontal.svg": "icons/adjustments-horizontal.svg",

Also sometimes it could lead to app crash:

/__enclose_io_memfs__/lib/ruby/2.7.0/json/common.rb:156: [BUG] Segmentation fault at 0x0000000000000000
ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-darwin20]

-- Crash Report log information --------------------------------------------
   See Crash Report log file under the one of following:
     * ~/Library/Logs/DiagnosticReports
     * /Library/Logs/DiagnosticReports                SEGV received in SEGV handler
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

No branches or pull requests

1 participant