Hi Ian, You are correct. The following test case is failing. I commented out the code to make sure whether my analysis is correct or not. Definitely, you people are experts. What could be the best fix for this issue? If you can help then that is really helpful.
=== RUN TestCallbackPanicLoop signal: segmentation fault FAIL misc/cgo/test 0.671s Best Regards Mariappan On Thu, Apr 6, 2023 at 2:22 AM Ian Lance Taylor <i...@golang.org> wrote: > On Tue, Apr 4, 2023 at 9:20 PM mariappan balraj > <mariappan.bal...@gmail.com> wrote: > > > > In my test case, I have tried, Go-->C-->Go->panic() only. > > You can run a bunch of cgo tests by running "go test" in the directory > $GOROOT/misc/cgo/test. > > Ian > > > > On Wed, Apr 5, 2023 at 3:35 AM Ian Lance Taylor <i...@golang.org> wrote: > >> > >> On Mon, Apr 3, 2023 at 9:26 PM mariappan balraj > >> <mariappan.bal...@gmail.com> wrote: > >> > > >> > Hi Kurtis Rader, > >> > > >> > Thanks for your response. I am working on it. I will quickly share > it. Before that one more update. I have commented the below two lines. Now > from the core, I am able to see the correct stack trace. > >> > > >> > 326 func unwindm(restore *bool) { > >> > 327 if *restore { > >> > 328 // Restore sp saved by cgocallback during > >> > 329 // unwind of g's stack (see comment at top of > file). > >> > 330 mp := acquirem() > >> > 331 //sched := &mp.g0.sched > >> > 332 //sched.sp = *(*uintptr)(unsafe.Pointer(sched.sp > + alignUp(sys.MinFrameSize, sys.StackAlign))) > >> > 333 > >> > 334 // Do the accounting that cgocall will not have a > chance to do > >> > 335 // during an unwind. > >> > 336 // > >> > 337 // In the case where a Go call originates from C, > ncgo is 0 > >> > 338 // and there is no matching cgocall to end. > >> > 339 if mp.ncgo > 0 { > >> > 340 mp.incgo = false > >> > 341 mp.ncgo-- > >> > 342 osPreemptExtExit(mp) > >> > 343 } > >> > 344 > >> > 345 releasem(mp) > >> > 346 } > >> > 347 } > >> > >> > >> > >> Just a note that in general we can't make that change, as it will > >> break the case where a Go function calls a C function calls a Go > >> function and that Go function calls panic. > >> > >> Ian > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAKKWi6SkVFB1V9af_BDeX8hEMg_hxnYxdkYvmW9HCufpms7Y5A%40mail.gmail.com.