-
-
Notifications
You must be signed in to change notification settings - Fork 925
Backport of bug fixes from master to jruby-1_6 #244
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
Conversation
FileLock.release() throwing Java::JavaLang::NullPointerException Strategy works like this...we may want a more conservative change for jruby-1_6 branch: * Check if lock state would change as a result. If not, return success * Synchronize on FileChannel * Check again * Perform operation This should reduce the cost of repeated locks and unlocks to nearly zero, make concurrent locking/unlocking safe, and localize synchronization to only the code that needs it.
Credit goes to headius.
…ly-multiplexed like RubyGems This commit adds regression spec. The actual fix is at 539f45c.
Compiler calls match2AndUpdateScope[19], which did not pass through the match result and instead fell back to logic that used the scope's match and assumed it was non-nill.
Instead of always using Object when calling autoload from an instance method, we use self's real class (skipping singletons) as the autoload location. This isn't exactly how MRI does it (they use cbase, which I think is euivalent to 1.8's ruby_class), but it should be correct for the majority of cases.
Because in JRuby, concurrent selects can trigger blocking mode exceptions, I've modified IO.select logic to raise a concurrency error when multiple threads try to select on the same sockets at the same time (and fail to do so cleanly). At present, there's no way to do this since we use these channels in both blocking and nonblocking mode; we can't synchronize the blocking mode changes with multiple threads all trying to do select operations.
Signed-off-by: Hiro Asari <asari.ruby@gmail.com>
…Y-6641) This fixes a simple typo in the RuntimeHelpers.isJavaExceptionHandled logic.
… our Ruby rake code for updating poms
RubyException.printBacktrace will now print all lines by default, and has a separate form for skipping some number of lines. All internal uses that expected the first line to be skipped use the second form.
This seems to be a flaw in the patch I provided for http://bugs.ruby-lang.org/issues/5698. Since that patch was only to improve perf of REXML in Ruby 1.8 mode, I think it's better to have slower and working than faster and broken. Reverting.
I'm committing a cardinal sin here by using Thread#stop, but I think in this case it's warranted (and probably safe enough). The threads in question are doing nothing but spinning on two IO streams, and even if they leave those streams unusable we're walking away from them anyway. This fix makes thread count stay stable for a tight backquote loop as described in the bug. I did try using our Executor, but the problem isn't reusing threads, it's terminating them completely.
* Passes the `mode` argument correctly from Kernel#open to IO#popen, so if a non-default mode is specified (e.g., "w"), it is honored Signed-off-by: Hiro Asari <asari.ruby@gmail.com>
Collections.shuffle works incorreclty on Ruby arrays We were not implementing List.set properly; it should return the previous value at that index, and we were just returning the given value.
…nt as well as sparklemotion/nokogiri#657. The change didn't break test:mri19. However, oddly, test_condvar_wait_exception_handling of test/externals/ruby1.9/ruby/test_thread.rb has become failing often on my macbook. But, not always. This change might have revealed threadding issue?
ClassCastException calling Fixnum#== with a Java Integer The problem here was that when given multiple overloads that are all dispatchable with a given set of arguments, we just picked the first one. This specific case had both compareTo(Object) and compareTo(Integer), and we picked the Object version. Because the coercion from Fixnum to Object produces a Long, we eventually hit a ClassCastException when the Object version tried to call the Integer version. By fixing Java method dispatch to narrow overloads to the most specific version, we now will call the Integer version and coerce properly. I believe this was working in 1.6.7 because we had other bugs relating to how we coerce versus how we dispatch that caused us to coerce to Integer but still call the Object version.
NO_FILE_CLASS Profile does disables File but not FileStats that depends on File Fix NO_FILE_CLASS profile to also disable FileStat.
Can't instantiate ThreadGroup subclass with arguments We had defined 'new' on ThreadGroup, when what we needed was an ObjectAllocator for the normal 'new' logic to work. With that fix, subclass initialize methods work fine.
class_eval should inherit __name__ from the caller class_eval/module_eval were still being framed, which caused them to interfere with getting the actual caller name. Removed the framing and the bug is fixed.
I opted to simply synchronize around the logic in question. The primary issue is the potential for "left" to get decremented below zero under concurrency while it is in use. I tried to figure out an AtomicInteger-based algorithm for guaranteeing both that left would never cause a <0 array dereference *and* would not produce the same random number twice, but was unable to find a way due to the multiple state changes that happen. Synchronization does slow things down a bit, but perhaps not enough to worry about: Before (single thread): system ~/projects/jruby $ jruby -rbenchmark -e '5.times { puts Benchmark.measure { Array.new(1).map {Thread.new{50000000.times{rand}}}.map(&:join) } }' 3.670000 0.130000 3.800000 ( 3.317000) 3.880000 0.150000 4.030000 ( 3.761000) 4.550000 0.150000 4.700000 ( 4.495000) 4.500000 0.160000 4.660000 ( 4.460000) 4.500000 0.150000 4.650000 ( 4.452000) After (single thread): system ~/projects/jruby $ jruby -rbenchmark -e '5.times { puts Benchmark.measure { Array.new(1).map {Thread.new{50000000.times{rand}}}.map(&:join) } }' 4.420000 0.130000 4.550000 ( 4.031000) 4.460000 0.170000 4.630000 ( 4.353000) 5.000000 0.160000 5.160000 ( 4.954000) 4.980000 0.160000 5.140000 ( 4.924000) 5.070000 0.160000 5.230000 ( 5.020000) After (100 threads, same workload): system ~/projects/jruby $ jruby -rbenchmark -e '5.times { puts Benchmark.measure { Array.new(100).map {Thread.new{500000.times{rand}}}.map(&:join) } }' 13.900000 5.400000 19.300000 ( 8.227000) 12.900000 5.250000 18.150000 ( 7.938000) 13.800000 5.680000 19.480000 ( 8.903000) 13.540000 5.750000 19.290000 ( 8.627000) 13.390000 5.560000 18.950000 ( 8.331000)
…va object * Allow ScriptingContainer#callMethod to be called using nil as a receiver
* Allow nil as a receiver * Allow Java objects as receivers. These will be wrapped before use.
Can't load class files in WARs compiled by warbler using jruby 1.7.0.preview1 When requiring a file with an explicit .class extension, assume the .class filename is the only filename to be searched. Because a require of .class almost always will indicate that the user wants to load a specific precompiled Ruby file, there's no good reason (I know of) to search for anything else. The original logic did not work at all; require 'foo.class' would search for 'foo.class.rb' and 'foo.class.class' (in that order) but never 'foo.class'. The claim is that this worked in 1.6.7.2, but I could not reproduce that with a simple case. The logic involved does not appear to have changed in a substantial way since well before 1.6.7.2, and in any case I believe the fix here is the right way for it to work.
Simple enough fix: added Number (and Serializable) to the map of types to converters in JavaUtil. Because our Numeric types were already reporting that their "natural" classes were Number subclasses, they were being selected for Number-receiving methods. But the coercion logic did not know about Number, so it failed.
java.lang.NullPointerException when using ScriptingCotainer from an Applet Properties retrieved in a restricted environment may be null. We must handle that case and not blindly try to getBytes().
Ok, time to broach the issue of the long delay in releases since 1.6.7, I guess. We are not opposed to merging fixes into the 1.6 branch, but because we're busy with 1.7 release cycle now it's unlikely that we will have the cycles necessary to do a 1.6.8 release. However...a few folks have proposed that we allow community-managed releases of earlier releases. We would not be responsible for them and would not make any guarantees about them, but if someone else is willing to go through the process of validating and building new releases, maybe it's worth exploring. I'll talk to @enebo about it today. |
Ok...so after talking with @enebo, we both agree it's worth doing a 1.6.8 release if we can get community help merging fixes over. This means you and others. I'm going to merge this request in, and we'll happily accept more for as many fixes as re easily portable to 1.6.8. I would probably recommend avoiding fixes for 1.9 issues unless they're small and easy to port over, since master has changed substantially since 1.6.7 and many fixes will require much more complicated and error-prone merging. But fixes that are small or for 1.8.7 logic are open game, as are fixes to subsystems that have not changed significantly like Java integration. |
32e22d6 Ruby 2.4 raises a TypeError for invalid step args 8466e7c Fixed issues in Kernel#rand specs 3e0334a Removed using BigDecimal in rand specs. 9b8927d String#dup returns copy when no modification made. a722922 Adds Numeric#step keyword arguments specs. 5114a66 Fixed edge case where small BigDecimal ranges were erroring ad9be02 Fix float ranges where diff of 0 c0e852a Fixed rand() for degenerative empty range bf42261 Only run frozen string literals specs on Ruby >= 2.3 faea24f Add two specs for new arrays with simple Fixnums bf9ad3a Ensure String#byteslice normalizes indices by byte length, not character length. b892ade BasicObject#instance_eval evaluates string with given filename and linenumber 946967e yield uses captured block of a block used in define_method 3e09f4e Spec that frozen string literals don't change what defined? returns, to protect against implementations that desugar the call away. 3f436dc Where we're testing the freeze command line flag, we shouldn't call .freeze. 47690be Where we're testing the freeze magic comment, we shouldn't call .freeze. 3d062e3 Add a spec for string literal freeze magic comment, where there is the same literal but in a file without the comment. b9c349e Add command-line specs for --enable-frozen-string-literal. b6c95d1 Add a spec for string literal freeze magic comment, where the literals are in different files but have different encodings. db22ba5 Add a spec for string literal freeze magic comment, where the literals are in different files. f8bfdb1 Add a spec for string literal freeze magic comment with two literals but the same content. 8a76900 Add a spec for string literal freeze magic comment with one literal. b70af78 Add a spec for the special String#freeze syntax. b3866cb New spec testing that compare_by_identity Hash do not call #hash. 0ade4ee Wait for the main thread to be interrupted in Thread#abort_on_exception spec 30cdf15 Remove bad rb_thread_call_without_gvl2 spec. 75c8c21 Merge pull request #248 from odaira/myContribution 99d20dc In AIX, when a pipe is readable, select(2) returns even the write side of the pipe as "readable" b60523a Merge pull request #247 from nobu/overridable-OBJDIR c5a98ec Make OBJDIR overridable 68dd505 Show our build status on Windows d7a5a7b File.new/open changes permissions of existing files on MRI on Windows 2077fec Try to write a more sensible spec for IO#write on Windows 5dae610 Try to read in text mode for IO#write spec on Windows 55cb889 Use local variables in Module#ancestors 2b3bf9e Merge pull request #245 from wied03/ancestors 8ad6780 Better test Module#ancestors cases e5765b1 Merge pull request #246 from wied03/class_to_s 723e4c9 Merge pull request #244 from wied03/master 7bf3a56 Test singleton class cases with `Class#to_s` 2341203 Test a strange module case compare edge case 4b6dd97 Merge pull request #243 from wied03/master 9c14562 Fill spec change from e60792ca2fe08ff2bb2f00eff7c6d70547cfc42e crashes Opal, so don't execute on that platform ac7f701 Merge pull request #241 from wied03/master a274931 First cut of Pathname#relative_path_from 4879393 Merge pull request #242 from znz/fix-typo 1a34bb3 Fix a typo bc2614f Cleanup and reorganize a bit extensions spec_helper 231f0ec Merge pull request #240 from nobu/no-capi-signatures 1829feb Fix .gitignore file to only consider files at the root 31252bd Move extension files to ext/RUBY_NAME/RUBY_VERSION 4834b1a No CAPI signature files 663c7a0 Add sentinel 71d6bde Remove mri.h as MRI should have all C-API functions spec'd in ruby/spec d294c56 Remove rb_inspecting_p and rb_protect_inspect specs since it is not standard e60792c Remove deviates_on and use numeric helpers for Array#fill b85c5f2 Remove extended_on and give proper describe blocks to rb_thread_blocking_region and such 0a9af62 Remove rb_str_ptr and rb_str_ptr_readonly since they are Rubinius-specific d6c3234 Remove extended_on for missing functionality 28c64c8 rb_obj_frozen_p exists on other implementations as well 1c00935 Merge pull request #239 from odaira/myContribution2 e2065d8 Merge pull request #238 from odaira/myContribution 7805965 AIX does not allow mkdir(2) to set a sticky bit c45706f Fix typo: 1755 intended to be 01755 ebfaf9d Exempt AIX in core/file/lchmod_spec.rb because it does not support lchmod(2) 260cdc3 Try a third way to pass the system spec and no issue console warnings 7462137 adapt expectation for exit status after SIGKILL on Windows 0bb8a49 Merge pull request #237 from iliabylich/add-tests-for-lbrace-arg-cases a3dc36f quarantine problematic name resolving spec ec8e369 SO_REUSEADDR seems to have a slightly different meaning in Windows 7784171 A getaddrinfo spec is also unsupported on Windows bfc9162 resolv with localhost seems not working on Windows 6d7ea9a Try to fix a system spec on Windows 8c87aba IO.copy_stream with IO with offsets is not supported on Windows 6c66468 File::Stat#nlink seems to be unreliable on Windows b73e686 Add tests for method calls that have a space between method name and parentheses. 82f728c Merge pull request #236 from iliabylich/add-specs-for-arity/parameters-for-attr_reader/writer c54cc3a Added specs for Method#arity and Method#parameters for methods generated by attr_reader/attr_writer. 9b45a0d Merge pull request #235 from wied03/master 0a570d9 Add Pathname#join specs, enhance ::new d6a94f7 Shell variable expansion in Kernel#system is spec on Windows. 64dba27 Remove libgmp from .travis.yml as ruby-head should not need it anymore. fa55c43 Merge pull request #234 from odaira/myContribution 8b77012 Default error message returned by stderror(3) is "Error <errno> occurred" on AIX ec4c0d0 Allow both US_ASCII and ASCII_8BIT if fs encoding is unset (LANG=C) d9dd997 Simplify File::Stat#inspect and do not expect birthtime in the output on Windows. 11544a8 Do not try to change the {a,m}time of an opened file in File::Stat#<=> specs b3ff895 Try to create files first in File::Stat#<=>. 37df92f Try to simplify the File#new spec with permissions. a8363e9 chown is no-op on Windows bd23a74 Math.lgamma(-0.0) is only guaranteed on 2.4 for now. e2e203b Merge pull request #233 from nobu/feature/Math#lgamma-0.0 a1e623f Math.lgamma returns [infinity, -1] on -0.0 d5e21c8 Move the #include triggering #included outside fixtures. 0e11702 Merge pull request #232 from wied03/super_again 0683a53 Fix another super case bbe5d48 Merge pull request #231 from wied03/more_super a081c74 Test more super edge cases c18e55b Merge pull request #229 from wied03/super_stuff b04d2fe Merge pull request #228 from nobu/trailing-spaces bd89b79 Merge pull request #227 from wied03/master cd06cdd super enhancement 9059448 remove trailing spaces a87ca8a Cover cases where the backslash itself is escaped 932fa26 Update Coverage specs to not filter the result if Ruby >= 2.4. 45935f3 Merge pull request #225 from nobu/bug/Dir.pwd-C 6d5daba Merge pull request #226 from ruby/try_with_gmp 7f04132 Fix Dir.pwd encoding f3a55e1 libgmp-devel apt package f90428f UNIX sockets only on UNIX dfdb6d0 Make clear that not.existing is not an extension b0bedcb Avoid warning by redirecting stderr on Windows 2ceb3bd Avoid changing LC_ALL, which has also no effect on Windows 26086ad Math.frexp returns an unspecified value for exp if value is NaN. 6cf4f32 File.expand_path does not care about the external Encoding on Windows 49701ab Try reading from the pipe to avoid warning on Windows 8d6f12a Use platform-specific @RootDir in File.expand_path spec 4e60d3d Avoid nonexistent pipe warning on Windows 24c26f9 Fix Dir.pwd encoding spec: it is the filesystem encoding. e5406c1 Avoid newlines in File#open spec. d21886d Disable autoclose if File.new(fd) does not raise an error 1f5ccb6 Fix namespace. d7c8746 Take in account imprecision of Math.gamma on Windows. ec58c97 Use a simpler way to know if Kernel has a private method with -n. 4f8ed56 Etc.group is not available on Windows 548e3c1 Avoid should_not raise_error. 40265a4 UNIXServer is not available on Windows b0a70f1 Merge pull request #224 from ruby/vais/windows 4c24384 Pass Dir.mktmpdir spec on Windows a0a0378 Adjust Socket constants and error classes for Windows 0d7762f not_supported_on is only for ruby implementations 9e87701 Adapt exception to Windows in recv_nonblock bf0e472 Refactor IO#{read,write}_nonblock_spec when there is no data available edaa5e7 Fix describe in Dir.mktmpdir spec e6f91c7 IO#expect and the exepct stdlib is not available on Windows 3bb7369 Workaround the problem to test respond_to?(:fork) and being able to call it publicly. e69370a Changing the time zone with Continent/City is unsupported on Windows c81e224 Try to include private methods in the fork #respond_to? test 096cb4c Revert "Process.respond_to?(:fork) seems to be true now on Windows" c6fcd2f Process.respond_to?(:fork) seems to be true now on Windows c31500a Process.maxgroups is not on implemented on Windows 0a2ff59 Windows guards for symlinks b5c2ed6 Guard UNIX-specific Signal.trap specs d194a30 Windows guards in IO#write_nonblock 1f701d9 More IO on Windows fixes 774fb8f Only notify on status change for Travis b8a8d3a Some IO on Windows fixes c3c16bb More File on Windows fixes 618fa06 Fix File specs on Windows. f5d45a0 Windows raises EISDIR for File.read(dir) dbe045a Open files with write mode for writing in File#open spec 2ea1128 Add Windows guards in File.{new,open} cd048ee Fix shared stat specs. 53b8dbc File.open with a directory is not supported on Windows. d1a895e Skip incompatible Process#kill specs on Windows 6dd62b3 Separate Process#kill specs which can be supported on Windows 3dae14d Deduplicate definition of native newline. 130a11d Merge pull request #223 from ruby/vais/windows 86a2514 Pass Kernel#spawn spec on Windows 15b803c Pass Kernel#exec with a command array spec on Windows e10c091 Merge pull request #222 from ruby/elia/explicit-fcall-as-default-arg 682e3c3 Use an ordinary Object instead of a String 18b9172 More explicit specs for fcall as default argument f13db61 Merge pull request #221 from ruby/vais/windows c716825 Pass Kernel#exec spec on Windows 80e5be3 Clearly separate non-compliant behavior on Windows using platform blocks 15c6b74 Pass Kernel#system spec on Windows 9049a75 Use a cross-platform alternative to system("false") 6fa70d1 Use a cross-platform alternative to system("true") 37677eb Pass IO.read spec on Windows 62e4e19 Pass IO#readlines spec on Windows d84d68a Pass IO.foreach spec on Windows 1b2cdcf Fix grouping of #slice_when spec. git-subtree-dir: spec/ruby git-subtree-split: 32e22d667b12f10655701487312926f394d1e2e9
I was able to cherry-pick the following 35 fixes from master on to jruby-1_6 with no conflicts and with all tests passing for each addition. Proposal for a 1.6.8 release forthcoming. In any case are these all well accepted, conservative fixes?
Note that I simply rejected anything that wasn't labelled a fix or that didn't apply cleanly. There might be some additional fix opportunities that would just require straight forward conflict resolution. Please let me know if you know of any you would like me to try that on and I'll add them here.