==================
WARNING: ThreadSanitizer: data race (pid=14056)
Write of size 8 at 0x7b04000000a0 by thread T19:
#0 free <null> (libtsan.so.0+0x35f45)
#1 <null> <null> (libc.so.6+0xd51b1)
#2 operator() /home/eagle/github/my/kvrocks/src/server.cc:78 (kvrocks+0x1e9b79)
#3 __invoke_impl<void, Server::Start()::<lambda()> > /usr/include/c++/9/bits/invoke.h:60 (kvrocks+0x1e9b79)
#4 __invoke<Server::Start()::<lambda()> > /usr/include/c++/9/bits/invoke.h:95 (kvrocks+0x1e9b79)
#5 _M_invoke<0> /usr/include/c++/9/thread:244 (kvrocks+0x1e9b79)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"encoding/json" | |
"fmt" | |
"sort" | |
) | |
func main() { | |
input := `{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Demostrate how to handle error in nodejs server | |
var restify = require('restify'); | |
function getHello(req, res, next) { | |
throw new Error('standard error happens here'); | |
} | |
function postHello(req, res, next) { | |
throw new MyError('here is my error'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"log" | |
"math/rand" | |
) | |
//import "runtime" | |
var x, y, r1, r2 int |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/usr/share/rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/reline/unicode.rb:188:in `get_next_mbchar_size': undefined method `grapheme_clusters' for nil:NilClass (NoMethodError) | |
3.0.0 :0from /usr/share/rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/reline/line_editor.rb:1413:in `ed_next_char' | |
3.0.0 :0from /usr/share/rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/reline/line_editor.rb:951:in `call' | |
3.0.0 :0from /usr/share/rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/reline/line_editor.rb:951:in `wrap_method_call' | |
from /usr/share/rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/reline/line_editor.rb:968:in `process_key' | |
from /usr/share/rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/reline/line_editor.rb:1076:in `input_key' | |
from /usr/share/rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/reline.rb:247:in `block (3 levels) in inner_readline' | |
from /usr/share/rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/reline.rb:246:in `each' | |
from /usr/share/rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/reline.rb:246:in `block (2 levels) in inner_readline' | |
from /usr/share |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"sync" | |
"sync/atomic" | |
"testing" | |
) | |
const THREADS int = 8 | |
const LOOP int = 100000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'json' | |
require 'thread' | |
# Thread.abort_on_exception = true | |
# Thread.report_on_exception = true | |
# this will raise SystemStackOverflow | |
def json_dump | |
obj = {} | |
obj['c'] = obj |
with cork
[pid 1503] 13:16:32.931451 ppoll([{fd=3, events=POLLIN}, {fd=4, events=POLLIN}], 2, NULL, NULL, 8 <unfinished ...>
[pid 1510] 13:16:32.947050 <... ppoll resumed> ) = 0 (Timeout)
[pid 1510] 13:16:32.947298 read(3, 0x7fdcd905e780, 8) = -1 EAGAIN (Resource temporarily unavailable)
[pid 1510] 13:16:32.947616 sched_yield() = 0
[pid 1510] 13:16:32.947800 ppoll([{fd=3, events=POLLIN}], 1, {tv_sec=1, tv_nsec=0}, NULL, 8) = 0 (Timeout)
[pid 1510] 13:16:33.949327 read(3, 0x7fdcd905e780, 8) = -1 EAGAIN (Resource temporarily unavailable)
[pid 1510] 13:16:33.949578 sched_yield() = 0
[pid 1510] 13:16:33.949748 ppoll([{fd=3, events=POLLIN}], 1, {tv_sec=1, tv_nsec=0}, NULL, 8) = 0 (Timeout)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* a sort demo while learning go goroutine | |
* sorting 10 million numbers concurrently | |
*/ | |
package main | |
import ( | |
"fmt" | |
"sort" |