Project

General

Profile

Actions

Bug #17791

closed

Ractor exception when using Nokogiri

Added by tomanderson (Thomas Ender) over 3 years ago. Updated over 3 years ago.

Status:
Third Party's Issue
Assignee:
-
Target version:
-
[ruby-core:103345]

Description

Parsing xml using nokogiri:

  doc = Nokogiri.XML('<foo><bar /></foo>', nil, 'EUC-JP')

Suppose I want to parse 4 xmls with 4 ractors, it will raise an unsafe exception:

Ractor::UnsafeError: ractor unsafe method called from not main ractor

the ruby version is 3.0.1.

I wonder if there is any way to avoid this.

Updated by xtkoba (Tee KOBAYASHI) over 3 years ago

This is because a function (read_memory) in a C extension (nokogiri.so) is called which is not marked as ractor-safe (see Feature #17307).

A workaround would be to mark it so, although I don't know if it is truly ractor-safe.

Updated by jeremyevans0 (Jeremy Evans) over 3 years ago

  • Status changed from Open to Rejected

Based on @xtkoba's analysis, closing as this doesn't appear to be a bug in Ruby.

Actions #3

Updated by nobu (Nobuyoshi Nakada) over 3 years ago

  • Description updated (diff)
  • Status changed from Rejected to Third Party's Issue
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0