mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	show the error message before Ractor.yield
Ractor's error will be printed if Thread#report_on_exception is true (default), and error message is used. Without this patch, the exception object is sent by Ractor.yield and it can be shared with another ractor. http://ci.rvm.jp/results/trunk-random3@phosphorus-docker/3269368 To prevent such sharing, show errors befor Ractor.yield().
This commit is contained in:
		
							parent
							
								
									fed67fe6b2
								
							
						
					
					
						commit
						a79fe07db6
					
				
					 1 changed files with 7 additions and 6 deletions
				
			
		
							
								
								
									
										13
									
								
								thread.c
									
										
									
									
									
								
							
							
						
						
									
										13
									
								
								thread.c
									
										
									
									
									
								
							| 
						 | 
					@ -831,18 +831,19 @@ thread_start_func_2(rb_thread_t *th, VALUE *stack_start)
 | 
				
			||||||
		/* exit on main_thread. */
 | 
							/* exit on main_thread. */
 | 
				
			||||||
	    }
 | 
						    }
 | 
				
			||||||
	    else {
 | 
						    else {
 | 
				
			||||||
                if (th->invoke_type == thread_invoke_type_ractor_proc) {
 | 
					 | 
				
			||||||
                    rb_ractor_atexit_exception(th->ec);
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                if (th->report_on_exception) {
 | 
					                if (th->report_on_exception) {
 | 
				
			||||||
		    VALUE mesg = rb_thread_to_s(th->self);
 | 
							    VALUE mesg = rb_thread_to_s(th->self);
 | 
				
			||||||
		    rb_str_cat_cstr(mesg, " terminated with exception (report_on_exception is true):\n");
 | 
							    rb_str_cat_cstr(mesg, " terminated with exception (report_on_exception is true):\n");
 | 
				
			||||||
		    rb_write_error_str(mesg);
 | 
							    rb_write_error_str(mesg);
 | 
				
			||||||
		    rb_ec_error_print(th->ec, errinfo);
 | 
							    rb_ec_error_print(th->ec, errinfo);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		if (th->vm->thread_abort_on_exception ||
 | 
					
 | 
				
			||||||
		    th->abort_on_exception || RTEST(ruby_debug)) {
 | 
					                if (th->invoke_type == thread_invoke_type_ractor_proc) {
 | 
				
			||||||
 | 
					                    rb_ractor_atexit_exception(th->ec);
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                if (th->vm->thread_abort_on_exception ||
 | 
				
			||||||
 | 
					                    th->abort_on_exception || RTEST(ruby_debug)) {
 | 
				
			||||||
		    /* exit on main_thread */
 | 
							    /* exit on main_thread */
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		else {
 | 
							else {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue