Skip to content
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

Crash when call it concurrently #5

Open
daxiaoluo opened this issue May 15, 2020 · 3 comments
Open

Crash when call it concurrently #5

daxiaoluo opened this issue May 15, 2020 · 3 comments

Comments

@daxiaoluo
Copy link

It was crashed, when I open 10 concurrent goruntines to call this function.
panic: (*otto._exception) (0x853ce0,0xc0005215a0)
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x30 pc=0x7e24a8]

goroutine 8 [running]:
github.com/robertkrimen/otto.catchPanic.func1(0xc00034d5f8)
/home/luotao/lib/gopath/src/github.com/robertkrimen/otto/error.go:248 +0x59e
panic(0x85bdc0, 0xc606e0)
/usr/lib/go-1.13/src/runtime/panic.go:679 +0x1b2
github.com/robertkrimen/otto.(_runtime).leaveScope(...)
/home/luotao/lib/gopath/src/github.com/robertkrimen/otto/runtime.go:86
github.com/robertkrimen/otto.(
_runtime).cmpl_evaluate_nodeProgram.func1(0xc000001b00)
/home/luotao/lib/gopath/src/github.com/robertkrimen/otto/cmpl_evaluate.go:11 +0x28
panic(0x853ce0, 0xc0005215a0)
/usr/lib/go-1.13/src/runtime/panic.go:679 +0x1b2
github.com/robertkrimen/otto.(_propertyReference).getValue(0xc0004a3920, 0x872940, 0xc0004a3920, 0x9910a0)
/home/luotao/lib/gopath/src/github.com/robertkrimen/otto/type_reference.go:36 +0x244
github.com/robertkrimen/otto.Value.resolve(0x8, 0x872940, 0xc0004a3920, 0x8, 0x872940, 0xc0004a3920)
/home/luotao/lib/gopath/src/github.com/robertkrimen/otto/value.go:493 +0x8f
github.com/robertkrimen/otto.(
_runtime).cmpl_evaluate_nodeDotExpression(0xc000001b00, 0xc000265a40, 0x9910a0, 0x872940, 0xc0004a38f0)
/home/luotao/lib/gopath/src/github.com/robertkrimen/otto/cmpl_evaluate_expression.go:258 +0x7f
github.com/robertkrimen/otto.(_runtime).cmpl_evaluate_nodeExpression(0xc000001b00, 0x987620, 0xc000265a40, 0x2, 0x835a00, 0xc8c160)
/home/luotao/lib/gopath/src/github.com/robertkrimen/otto/cmpl_evaluate_expression.go:50 +0x8ed
github.com/robertkrimen/otto.(
_runtime).cmpl_evaluate_nodeBinaryExpression_comparison(0xc000001b00, 0xc000265a70, 0x7f05bb9fb278, 0x836680, 0xc000521580)
/home/luotao/lib/gopath/src/github.com/robertkrimen/otto/cmpl_evaluate_expression.go:164 +0xab
github.com/robertkrimen/otto.(_runtime).cmpl_evaluate_nodeExpression(0xc000001b00, 0x987520, 0xc000265a70, 0x3, 0x836680, 0xc000521580)
/home/luotao/lib/gopath/src/github.com/robertkrimen/otto/cmpl_evaluate_expression.go:35 +0xa65
github.com/robertkrimen/otto.(
_runtime).cmpl_evaluate_nodeForStatement(0xc000001b00, 0xc000420370, 0xc000265950, 0x2, 0x835a00)
/home/luotao/lib/gopath/src/github.com/robertkrimen/otto/cmpl_evaluate_statement.go:256 +0x477
github.com/robertkrimen/otto.(_runtime).cmpl_evaluate_nodeStatement(0xc000001b00, 0x9876a0, 0xc000420370, 0x0, 0x0, 0x0)
/home/luotao/lib/gopath/src/github.com/robertkrimen/otto/cmpl_evaluate_statement.go:68 +0x11ba
github.com/robertkrimen/otto.(
_runtime).cmpl_evaluate_nodeStatementList(0xc000001b00, 0xc0001340f0, 0xf, 0xf, 0x7, 0x0, 0x1)
/home/luotao/lib/gopath/src/github.com/robertkrimen/otto/cmpl_evaluate_statement.go:121 +0x8e
github.com/robertkrimen/otto.(_runtime).cmpl_evaluate_nodeStatement(0xc000001b00, 0x987540, 0xc0001fa280, 0x0, 0x0, 0x0)
/home/luotao/lib/gopath/src/github.com/robertkrimen/otto/cmpl_evaluate_statement.go:30 +0x587
github.com/robertkrimen/otto.(
_runtime).cmpl_call_nodeFunction(0xc000001b00, 0xc0002a0120, 0xc0004a2330, 0xc0000e2600, 0x0, 0x0, 0x0, 0xc000514700, 0x1, 0x1, ...)
/home/luotao/lib/gopath/src/github.com/robertkrimen/otto/cmpl_evaluate.go:61 +0x48c
github.com/robertkrimen/otto.(_object).call(0xc0002a0120, 0x0, 0x0, 0x0, 0xc000514700, 0x1, 0x1, 0x0, 0x0, 0x0, ...)
/home/luotao/lib/gopath/src/github.com/robertkrimen/otto/type_function.go:226 +0xa8a
github.com/robertkrimen/otto.(
_runtime).cmpl_evaluate_nodeCallExpression(0xc000001b00, 0xc000596330, 0x0, 0x0, 0x0, 0x836440, 0x1, 0xc000521080)
/home/luotao/lib/gopath/src/github.com/robertkrimen/otto/cmpl_evaluate_expression.go:244 +0x47a
github.com/robertkrimen/otto.(_runtime).cmpl_evaluate_nodeExpression(0xc000001b00, 0x9875a0, 0xc000596330, 0x836680, 0xc000521080, 0xc00034d2b8)
/home/luotao/lib/gopath/src/github.com/robertkrimen/otto/cmpl_evaluate_expression.go:44 +0x583
github.com/robertkrimen/otto.(
_runtime).cmpl_evaluate_nodeStatement(0xc000001b00, 0x987660, 0xc0005208e0, 0x0, 0x0, 0x0)
/home/luotao/lib/gopath/src/github.com/robertkrimen/otto/cmpl_evaluate_statement.go:62 +0xf10
github.com/robertkrimen/otto.(_runtime).cmpl_evaluate_nodeStatementList(0xc000001b00, 0xc0003b2370, 0x5, 0x5, 0xc00034d5a8, 0x778e56, 0x836680)
/home/luotao/lib/gopath/src/github.com/robertkrimen/otto/cmpl_evaluate_statement.go:121 +0x8e
github.com/robertkrimen/otto.(
_runtime).cmpl_evaluate_nodeProgram(0xc000001b00, 0xc00011c620, 0xc00011c600, 0x0, 0x0, 0x0)
/home/luotao/lib/gopath/src/github.com/robertkrimen/otto/cmpl_evaluate.go:17 +0x10b
github.com/robertkrimen/otto.(_runtime).cmpl_runOrEval.func1()
/home/luotao/lib/gopath/src/github.com/robertkrimen/otto/runtime.go:785 +0x44
github.com/robertkrimen/otto.catchPanic(0xc00034d660, 0x0, 0x0)
/home/luotao/lib/gopath/src/github.com/robertkrimen/otto/error.go:251 +0x5f
github.com/robertkrimen/otto.(
_runtime).cmpl_runOrEval(0xc000001b00, 0x836680, 0x97d380, 0x0, 0x0, 0xc000001b00, 0x8d1ac1, 0xb, 0x3, 0x836680, ...)
/home/luotao/lib/gopath/src/github.com/robertkrimen/otto/runtime.go:784 +0x10f
github.com/robertkrimen/otto.(*_runtime).cmpl_run(...)
/home/luotao/lib/gopath/src/github.com/robertkrimen/otto/runtime.go:797
github.com/robertkrimen/otto.Otto.Run(0x0, 0xc000001b00, 0x836680, 0x97d380, 0x8c9100, 0xc00052a100, 0x0, 0x0, 0x0)
/home/luotao/lib/gopath/src/github.com/robertkrimen/otto/otto.go:295 +0x53
github.com/bregydoc/gtranslate.sM(0x3, 0x836680, 0xc000796240, 0xc0006d37d8, 0x1, 0x1, 0x0, 0x0, 0x836680, 0xc000796240, ...)
/home/luotao/lib/gopath/src/github.com/bregydoc/gtranslate/token.go:29 +0x19a
github.com/bregydoc/gtranslate.get(0x3, 0x836680, 0xc000796240, 0x3, 0x836680, 0xc000130a50, 0x0, 0x0)
/home/luotao/lib/gopath/src/github.com/bregydoc/gtranslate/token.go:136 +0xce
github.com/bregydoc/gtranslate.translate(0xc0001c40a0, 0x1c, 0x8cf2aa, 0x2, 0x8cfbbf, 0x5, 0x1000000000001, 0x2, 0x0, 0xc0001c40a0, ...)
/home/luotao/lib/gopath/src/github.com/bregydoc/gtranslate/apiv2.go:46 +0x11c
github.com/bregydoc/gtranslate.TranslateWithParams(0xc0001c40a0, 0x1c, 0x8cf2aa, 0x2, 0x8cfbbf, 0x5, 0x0, 0x0, 0xc0001c40a0, 0x1c, ...)
/home/luotao/lib/gopath/src/github.com/bregydoc/gtranslate/gtranslate.go:28 +0x8f
main.trans(0x8cf2aa, 0x2, 0xc000189aa0, 0x21, 0xc0002ba000, 0x2, 0x2, 0x14)

@yznts
Copy link

yznts commented Sep 2, 2020

GTranslate issue, related to concurrency #5

@mind1949
Copy link

mind1949 commented Sep 2, 2020

GTranslate issue, related to concurrency #5

you can try googletrans, it's concurrency-safe and has better performance .

@yznts
Copy link

yznts commented Sep 2, 2020

Oops! That comment not for that thread. Missed that, sorry.
This package was used in another repo and this is just related issue.

Thank you very much for advice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants