Comments (10)
It's the child_io
who needs to be patched, rather than the parent_io
. The return value of popen3
is parent_io
. Therefore, popen3
has to be patched internally.
from sass-embedded-host-ruby.
I have to take a more detailed look but most likely JDK21 + JRuby issue with stdio handling in the open3
gem.
The code path that Dart VM ran into issue is where itβs trying to write its stdout to send response back to Ruby side. - This means at least the Dart VM received the request properly, so that sprockets, sassc-embedded, sass-embedded, and protobuf are all likely working.
The stdout of a child process can get stuck if the polling thread from the parent process is not working properly. If the stdout pipe buffer is completely full, and the parent process is not consuming the buffer at all, the whole child process can get stuck.
from sass-embedded-host-ruby.
@chadlwilson Also, was it on windows or unix-like, or both? JRuby has different I/O implementation for open3 on windows and unix-like.
from sass-embedded-host-ruby.
This was on MacOS Sonoma 14.5
(sorry, updated description) but I can give it a go on Linux if that helps (sounds like probably roughly the same behaviour expected though?).
I haven't yet attempted on Windows; usually that's the "final frontier" :D
from sass-embedded-host-ruby.
Hmm, could it be jruby/jruby#8235 or jruby/jruby#8069 or jruby/jruby#8234 ?
from sass-embedded-host-ruby.
I can reproduce this in CI with the following code:
10000.times do |i|
Sass.compile_string('a{b:c}' * i).css
puts i
end
On windows it works to the end. However on unix-like, this works until the 4368th iteration but fails at the 4369th iteration.
On the 4368th iteration, the size of protobuf reply message is 65530 bytes, and on the 4369th iteration the size of reply message is 65545 bytes.
require 'sass-embedded'
Sass.compile_string('a{b:c}' * 4368).css # works, stdout reply size is 65530 bytes
Sass.compile_string('a{b:c}' * 4369).css # fails, stdout reply size is 65545 bytes.
It must be jruby/jruby#8235.
from sass-embedded-host-ruby.
OK, will close this for now and track there. Thanks for the effort, as always!
from sass-embedded-host-ruby.
I tried to monkey patch the Connection
class and streams as in jruby/jruby#8235 (comment) but my Ruby and monkey-patching abilities are probably a bit too limited for that one :)
from sass-embedded-host-ruby.
# frozen_string_literal: true
require 'fcntl'
module Open3
_popen_run = instance_method(:popen_run)
define_method(:popen_run) do |cmd, opts, child_io, parent_io, &block|
child_io.each do |io|
flags = io.fcntl(Fcntl::F_GETFL)
io.fcntl(Fcntl::F_SETFL, flags | (Fcntl::O_NONBLOCK))
io.fcntl(Fcntl::F_SETFL, flags & (~Fcntl::O_NONBLOCK))
end
_popen_run.bind(self).call(cmd, opts, child_io, parent_io, &block)
end
module_function :popen_run
class << self
private :popen_run
end
end
from sass-embedded-host-ruby.
Works like a dream! Didn't think of trying to monkey patch popen
directly.
from sass-embedded-host-ruby.
Related Issues (20)
- Building sass-embedded fails on Nix HOT 1
- fail to install Could not find sass-embedded-1.58.3-x86_64-linux.gem HOT 2
- Cannot support NixOS HOT 7
- Failed to install on Github Actions after bundle update from 1.5x to 1.62 HOT 3
- Fails to install "jekyll" & "github-pages" with v1.63.1 HOT 3
- Upgrading sass-embedded from 1.62.1 to 1.63.x causes tooling to generate wrong RBI for Sass::EmbeddedProtocol::Value::ArgumentList HOT 3
- Upgrade sass-embedded from 1.66.1 to 1.67.0 problem HOT 1
- Unable to deploy on systems using x86_64-linux HOT 4
- Unable to install sass-embedded gem due to missing protoc HOT 2
- 1.69.4 is not thread-safe HOT 2
- Processes are leaking, elevated memory usage HOT 10
- Cannot install gem on debian:unstable HOT 19
- Rubygems is pointing on wrong version of library on Rocky 9 HOT 12
- Broken gemspec for sass-embedded-1.77.0-x86_64 HOT 2
- Can't find stylesheet to import: @import "font-awesome" HOT 1
- Gem fails when trying to run on aarch64-linux-musl platform HOT 4
- Support musl-libc HOT 2
- Please be a co-maintainer on dartsass-sprockets gem
- Build error on Alpine s390x HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sass-embedded-host-ruby.