Code Monkey home page Code Monkey logo

Comments (1)

wwhai avatar wwhai commented on September 18, 2024

Unit test:

func Test_loop_close(t *testing.T) {
	var s1 = `
		function f()
			while true do
			print("Hello World")
			end
		end
		f()
	`
	var luaVM = lua.NewState()
	go func() {
		err1 := luaVM.DoString(s1)
		if err1 != nil {
			panic(err1)
		}
	}()
	time.Sleep(3 * time.Second)
	luaVM.Close()
}

Panic log:

panic: runtime error: invalid memory address or nil pointer dereference [recovered]      
        panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x50 pc=0xb1a892]

goroutine 16 [running]:
github.com/yuin/gopher-lua.(*LState).PCall.func1()
        C:/Users/admin/go/pkg/mod/github.com/yuin/[email protected]/state.go:2020 +0x532
panic({0x1608280, 0x145c120})
        C:/Program Files/Go/src/runtime/panic.go:884 +0x213
github.com/yuin/gopher-lua.callGFunction(0xc0000ad6b0, 0x0)
        C:/Users/admin/go/pkg/mod/github.com/yuin/[email protected]/vm.go:262 +0x2f9
github.com/yuin/gopher-lua.init.3.func26(0xc0000ad6b0, 0x18000000?, 0xc000681000?)       
        C:/Users/admin/go/pkg/mod/github.com/yuin/[email protected]/vm.go:821 +0x379
github.com/yuin/gopher-lua.mainLoop(0xc0000ad6b0, 0xc0000ec600?)
        C:/Users/admin/go/pkg/mod/github.com/yuin/[email protected]/vm.go:31 +0xfa
github.com/yuin/gopher-lua.(*LState).callR(0xc0000ad6b0, 0x0, 0xffffffffffffffff, 0xc000117f38?)
        C:/Users/admin/go/pkg/mod/github.com/yuin/[email protected]/state.go:1211 +0x1b4
github.com/yuin/gopher-lua.(*LState).Call(...)
        C:/Users/admin/go/pkg/mod/github.com/yuin/[email protected]/state.go:1967
github.com/yuin/gopher-lua.(*LState).PCall(0xc0000ad6b0, 0x0, 0xc0000ec600?, 0x0)        
        C:/Users/admin/go/pkg/mod/github.com/yuin/[email protected]/state.go:2030 +0x145
github.com/yuin/gopher-lua.(*LState).DoString(0xc0000ad6b0, {0x18c04d2?, 0x0?})
        C:/Users/admin/go/pkg/mod/github.com/yuin/[email protected]/auxlib.go:405 +0x6b
github.com/i4de/rulex/test.Test_loop_close.func1()
        C:/Users/admin/workspace/rulex/test/calllua_test.go:172 +0x25
created by github.com/i4de/rulex/test.Test_loop_close
        C:/Users/admin/workspace/rulex/test/calllua_test.go:171 +0x7d
FAIL    github.com/i4de/rulex/test      3.260s
FAIL

from go-lua.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.