首页 > 系统相关 >【发现一个问题】go test的时候,在macos arm64 下不明原因的发生异常,但是在linux下完全正常

【发现一个问题】go test的时候,在macos arm64 下不明原因的发生异常,但是在linux下完全正常

时间:2025-01-23 14:23:54浏览次数:1  
标签:opt src macos Cellar arm64 go homebrew runtime

作者:张富春(ahfuzhang),转载时请注明作者和引用链接,谢谢!


这只是一个简单的队列,在单个协程中运行,莫名其妙就 panic 了,而且堆栈信息中找不到有用信息。
同样的程序在 linux 中执行又是对的。
暂时想不明白是为什么。

Running tool: /opt/homebrew/bin/go test -timeout 30s -run ^Test_SpscQueue_With_diff_size$ github.com/ahfuzhang/spscqueue

=== RUN   Test_SpscQueue_With_diff_size
unexpected fault address 0x140000d700e
fatal error: fault
[signal SIGBUS: bus error code=0x1 addr=0x140000d700e pc=0x100e898e0]

goroutine 6 gp=0x14000003dc0 m=0 mp=0x100fd9c20 [running]:
runtime.throw({0x100e92d5d?, 0x69?})
        /opt/homebrew/Cellar/go/1.22.0/libexec/src/runtime/panic.go:1023 +0x40 fp=0x140000565e0 sp=0x140000565b0 pc=0x100dc2230
runtime.sigpanic()
        /opt/homebrew/Cellar/go/1.22.0/libexec/src/runtime/signal_unix.go:878 +0x178 fp=0x14000056640 sp=0x140000565e0 pc=0x100ddae98
github.com/ahfuzhang/spscqueue.(*SpscQueue).Alloc(0x2007?, 0xed6220?)
        /code/github.com/ahfuzhang/spscqueue/spsc_queue.go:287 +0x1c0 fp=0x14000056670 sp=0x14000056650 pc=0x100e898e0
github.com/ahfuzhang/spscqueue.oneByOneTest({0x100f02030, 0x140000d6000}, 0x1)
        /code/github.com/ahfuzhang/spscqueue/spsc_queue_test.go:672 +0x5c fp=0x140000566d0 sp=0x14000056670 pc=0x100e8f7ac
github.com/ahfuzhang/spscqueue.Test_SpscQueue_With_diff_size(0x1400009e680)
        /code/github.com/ahfuzhang/spscqueue/spsc_queue_test.go:721 +0xf8 fp=0x14000056760 sp=0x140000566d0 pc=0x100e8fa48
testing.tRunner(0x1400009e680, 0x100effaa0)
        /opt/homebrew/Cellar/go/1.22.0/libexec/src/testing/testing.go:1689 +0xec fp=0x140000567b0 sp=0x14000056760 pc=0x100e504fc
testing.(*T).Run.gowrap1()
        /opt/homebrew/Cellar/go/1.22.0/libexec/src/testing/testing.go:1742 +0x2c fp=0x140000567d0 sp=0x140000567b0 pc=0x100e5134c
runtime.goexit({})
        /opt/homebrew/Cellar/go/1.22.0/libexec/src/runtime/asm_arm64.s:1222 +0x4 fp=0x140000567d0 sp=0x140000567d0 pc=0x100dfb534
created by testing.(*T).Run in goroutine 1
        /opt/homebrew/Cellar/go/1.22.0/libexec/src/testing/testing.go:1742 +0x318

goroutine 1 gp=0x140000021c0 m=nil [chan receive]:
runtime.gopark(0x140000c59c8?, 0x1400009cdd0?, 0x58?, 0xce?, 0x1400009cdd0?)
        /opt/homebrew/Cellar/go/1.22.0/libexec/src/runtime/proc.go:402 +0xc8 fp=0x140000c5990 sp=0x140000c5970 pc=0x100dc5088
runtime.chanrecv(0x140000880e0, 0x140000c5a8f, 0x1)
        /opt/homebrew/Cellar/go/1.22.0/libexec/src/runtime/chan.go:583 +0x404 fp=0x140000c5a10 sp=0x140000c5990 pc=0x100d908c4
runtime.chanrecv1(0x100fd8f20?, 0x100ed61a0?)
        /opt/homebrew/Cellar/go/1.22.0/libexec/src/runtime/chan.go:442 +0x14 fp=0x140000c5a40 sp=0x140000c5a10 pc=0x100d904b4
testing.(*T).Run(0x1400009e4e0, {0x100e98cf6?, 0x140000c5b38?}, 0x100effaa0)
        /opt/homebrew/Cellar/go/1.22.0/libexec/src/testing/testing.go:1750 +0x32c fp=0x140000c5b00 sp=0x140000c5a40 pc=0x100e5121c
testing.runTests.func1(0x1400009e4e0)
        /opt/homebrew/Cellar/go/1.22.0/libexec/src/testing/testing.go:2161 +0x40 fp=0x140000c5b40 sp=0x140000c5b00 pc=0x100e52ff0
testing.tRunner(0x1400009e4e0, 0x140000c5c58)
        /opt/homebrew/Cellar/go/1.22.0/libexec/src/testing/testing.go:1689 +0xec fp=0x140000c5b90 sp=0x140000c5b40 pc=0x100e504fc
testing.runTests(0x1400000e030, {0x100fc1f00, 0xd, 0xd}, {0x1400006bd18?, 0x100e3ea80?, 0x100fd9100?})
        /opt/homebrew/Cellar/go/1.22.0/libexec/src/testing/testing.go:2159 +0x3b0 fp=0x140000c5c80 sp=0x140000c5b90 pc=0x100e52ef0
testing.(*M).Run(0x140000961e0)
        /opt/homebrew/Cellar/go/1.22.0/libexec/src/testing/testing.go:2027 +0x5a4 fp=0x140000c5eb0 sp=0x140000c5c80 pc=0x100e51c24
main.main()
        _testmain.go:71 +0x16c fp=0x140000c5f40 sp=0x140000c5eb0 pc=0x100e91aec
runtime.main()
        /opt/homebrew/Cellar/go/1.22.0/libexec/src/runtime/proc.go:271 +0x28c fp=0x140000c5fd0 sp=0x140000c5f40 pc=0x100dc4c2c
runtime.goexit({})
        /opt/homebrew/Cellar/go/1.22.0/libexec/src/runtime/asm_arm64.s:1222 +0x4 fp=0x140000c5fd0 sp=0x140000c5fd0 pc=0x100dfb534

goroutine 2 gp=0x14000002c40 m=nil [force gc (idle)]:
runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
        /opt/homebrew/Cellar/go/1.22.0/libexec/src/runtime/proc.go:402 +0xc8 fp=0x14000054f90 sp=0x14000054f70 pc=0x100dc5088
runtime.goparkunlock(...)
        /opt/homebrew/Cellar/go/1.22.0/libexec/src/runtime/proc.go:408
runtime.forcegchelper()
        /opt/homebrew/Cellar/go/1.22.0/libexec/src/runtime/proc.go:326 +0xb8 fp=0x14000054fd0 sp=0x14000054f90 pc=0x100dc4ee8
runtime.goexit({})
        /opt/homebrew/Cellar/go/1.22.0/libexec/src/runtime/asm_arm64.s:1222 +0x4 fp=0x14000054fd0 sp=0x14000054fd0 pc=0x100dfb534
created by runtime.init.6 in goroutine 1
        /opt/homebrew/Cellar/go/1.22.0/libexec/src/runtime/proc.go:314 +0x24

goroutine 3 gp=0x14000003500 m=nil [GC sweep wait]:
runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
        /opt/homebrew/Cellar/go/1.22.0/libexec/src/runtime/proc.go:402 +0xc8 fp=0x14000055760 sp=0x14000055740 pc=0x100dc5088
runtime.goparkunlock(...)
        /opt/homebrew/Cellar/go/1.22.0/libexec/src/runtime/proc.go:408
runtime.bgsweep(0x14000088000)
        /opt/homebrew/Cellar/go/1.22.0/libexec/src/runtime/mgcsweep.go:278 +0xa0 fp=0x140000557b0 sp=0x14000055760 pc=0x100dafa30
runtime.gcenable.gowrap1()
        /opt/homebrew/Cellar/go/1.22.0/libexec/src/runtime/mgc.go:203 +0x28 fp=0x140000557d0 sp=0x140000557b0 pc=0x100da3c58
runtime.goexit({})
        /opt/homebrew/Cellar/go/1.22.0/libexec/src/runtime/asm_arm64.s:1222 +0x4 fp=0x140000557d0 sp=0x140000557d0 pc=0x100dfb534
created by runtime.gcenable in goroutine 1
        /opt/homebrew/Cellar/go/1.22.0/libexec/src/runtime/mgc.go:203 +0x6c

goroutine 4 gp=0x140000036c0 m=nil [GC scavenge wait]:
runtime.gopark(0x14000088000?, 0x100ec54f0?, 0x1?, 0x0?, 0x140000036c0?)
        /opt/homebrew/Cellar/go/1.22.0/libexec/src/runtime/proc.go:402 +0xc8 fp=0x14000055f60 sp=0x14000055f40 pc=0x100dc5088
runtime.goparkunlock(...)
        /opt/homebrew/Cellar/go/1.22.0/libexec/src/runtime/proc.go:408
runtime.(*scavengerState).park(0x100fd9220)
        /opt/homebrew/Cellar/go/1.22.0/libexec/src/runtime/mgcscavenge.go:425 +0x5c fp=0x14000055f90 sp=0x14000055f60 pc=0x100dad42c
runtime.bgscavenge(0x14000088000)
        /opt/homebrew/Cellar/go/1.22.0/libexec/src/runtime/mgcscavenge.go:653 +0x44 fp=0x14000055fb0 sp=0x14000055f90 pc=0x100dad984
runtime.gcenable.gowrap2()
        /opt/homebrew/Cellar/go/1.22.0/libexec/src/runtime/mgc.go:204 +0x28 fp=0x14000055fd0 sp=0x14000055fb0 pc=0x100da3bf8
runtime.goexit({})
        /opt/homebrew/Cellar/go/1.22.0/libexec/src/runtime/asm_arm64.s:1222 +0x4 fp=0x14000055fd0 sp=0x14000055fd0 pc=0x100dfb534
created by runtime.gcenable in goroutine 1
        /opt/homebrew/Cellar/go/1.22.0/libexec/src/runtime/mgc.go:204 +0xac

goroutine 5 gp=0x14000003c00 m=nil [finalizer wait]:
runtime.gopark(0x0?, 0x0?, 0xb8?, 0x45?, 0x100df6aa4?)
        /opt/homebrew/Cellar/go/1.22.0/libexec/src/runtime/proc.go:402 +0xc8 fp=0x14000054580 sp=0x14000054560 pc=0x100dc5088
runtime.runfinq()
        /opt/homebrew/Cellar/go/1.22.0/libexec/src/runtime/mfinal.go:194 +0x108 fp=0x140000547d0 sp=0x14000054580 pc=0x100da2d28
runtime.goexit({})
        /opt/homebrew/Cellar/go/1.22.0/libexec/src/runtime/asm_arm64.s:1222 +0x4 fp=0x140000547d0 sp=0x140000547d0 pc=0x100dfb534
created by runtime.createfing in goroutine 1
        /opt/homebrew/Cellar/go/1.22.0/libexec/src/runtime/mfinal.go:164 +0x80
FAIL    github.com/ahfuzhang/spscqueue  0.657s

标签:opt,src,macos,Cellar,arm64,go,homebrew,runtime
From: https://www.cnblogs.com/ahfuzhang/p/18687705

相关文章

  • Golang笔记——静态强类型、编译型、并发型语言
    大家好,这里是GoodNote,关注公主号:Goodnote,专栏文章私信限时Free。本文详细介绍Go语言的基础知识,包括数据类型,深浅拷贝,编程范式,Go语言是一种静态(静态类型语言和静态语言)强类型、编译型、并发型,并具有垃圾回收功能的编程语言。文章目录1.Go语言基础知识数据类型......
  • 打卡信奥刷题(651)用C++信奥P8396[普及组/提高] [CCC2022 S2] Good Groups
    [CCC2022S2]GoodGroups题目背景请注意:这道题是CCO2022J4GoodGroups的加强版。管理备注:似乎没有加强。题目描述一个班级会被分成ggg个组,每个组有三个人,这......
  • go操作kafka
    1、创建kafka使用DockerCompose快速搭建,windows使用dockerdesktop部署,linux使用docker部署以linux为例:创建docker-compose.yml文件,搭建单节点zookeeper和单节点kafka环境,并且在8080端口提供kafka-ui管理界面。docker-compose.ymlversion:'2.1'services:zoo1:imag......
  • 最新毕设-Django-新能源汽车推荐系统-30063(免费领项目)可做计算机毕业设计JAVA、PHP、
    摘要本论文主要论述了如何基于Django框架开发一个新能源汽车推荐系统,本系统将严格按照软件开发流程进行各个阶段的工作,爬取懂车帝的汽车信息,面向对象编程思想进行项目开发。在引言中,作者将论述新能源汽车推荐系统的当前背景以及系统开发的目的,后续章节将严格按照软件开发流程,......
  • 如何在织梦CMS中修改网站logo?
    织梦CMS是一种功能强大的内容管理系统,修改网站logo相对简单。以下是详细的步骤:备份文件: 在进行任何修改之前,确保备份网站的logo文件。准备新logo: 准备一个新的logo图片,确保图片格式为PNG或JPEG,并且大小适合网站的需求。上传新logo: 使用FTP工具(如FileZilla)连接到服务器,将新l......
  • 请问如何在织梦CMS中修改网站logo?
    织梦CMS是一种功能强大的内容管理系统,修改网站logo相对简单。以下是详细的步骤:备份文件: 在进行任何修改之前,确保备份网站的logo文件。准备新logo: 准备一个新的logo图片,确保图片格式为PNG或JPEG,并且大小适合网站的需求。上传新logo: 使用FTP工具(如FileZilla)连接到服务器,将新l......
  • go语言中的ew函数介绍
    在Go语言中,new是一个内建函数,用于分配内存并返回一个指向新分配的零值的指针。其主要作用是创建一个类型为T的新变量,并初始化为该类型的零值,返回指向这个变量的指针。它的语法和基本使用方法如下:new函数的基本语法new(T)T是你想要创建的新变量的类型。new(T)返回的......
  • 【JWT】jwt认证机制认识与理解,go案例实现
    JWT认证机制JWT(JSONWebToken)是一种轻量级的身份认证机制,广泛应用于现代Web开发中,尤其是在分布式系统和微服务中。它通过签名技术确保数据的真实性和完整性。1.JWT的基本结构JWT是一个由三部分组成的字符串(头部,负载,签名):Header.Payload.Signature1.1Header(头......
  • Go学习:多个变量或常量定义
    目录1.不同类型变量的声明(定义)2. 不同类型常量的声明(定义)1.不同类型变量的声明(定义)传统方法//不同类型变量的声明(定义)   varaint   varbfloat64    a,b=10,3.14packagemainimport"fmt"funcmain(){ //不同类型变量的声明(定义......
  • 路径规划之启发式算法之二十七:果蝇优化算法(Fruit Fly Optimization Algorithm,FOA)
            果蝇优化算法(FruitFlyOptimizationAlgorithm,FOA)是一种基于果蝇觅食行为的仿生学原理而提出的新兴群体智能优化算法。是众多群体智能算法之一,可看我的文章:仿生的群体智能算法总结之二(十种)_群体仿生智能-CSDN博客仿生的群体智能算法总结之二(十种)_群体仿生智......