Cassandra Windows 10 EXCEPTION_ACCESS_VIOLATION解决

文章描述了Cassandra在Windows10环境中启动时遇到EXCEPTION_ACCESS_VIOLATION的问题,该问题与JRE版本和sigar-amd64-winnt.dll文件有关。解决方案是重命名lib目录下的sigar-amd64-winnt.dll文件,从而避免启动时加载此文件,之后Cassandra能够成功启动并允许root用户登录进行CQL操作。

小结

Cassandra启动报错:EXCEPTION_ACCESS_VIOLATION,进行了解决。

问题

Cassandra启动报错:

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0000000010014ed4, pid=1224, tid=0x0000000000004084
#
# JRE version: Java(TM) SE Runtime Environment (8.0_261-b12) (build 1.8.0_261-b12)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.261-b12 mixed mode windows-amd64 compressed oops)
# Problematic frame:
# C  [sigar-amd64-winnt.dll+0x14ed4]
#
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

环境:

  • Windows 10 Pro
  • Cassandra 3.11.9
  • JDK: java version “1.8.0_261”

解决

参考Stackoverflow:Cassandra Windows 10 Access Violation

由于启动过程中加载sigar-amd64-winnt.dll文件出错,到D:\apache-cassandra-3.11.9\lib这个目录下将这个文件改成其它名字,这样Cassandra 启动时就不会加载这个文件了。

改完后重新启动成功:

D:\apache-cassandra-3.11.9\bin>cassandra
Detected powershell execution permissions.  Running with enhanced startup scripts.

Security warning
Run only scripts that you trust. While scripts from the internet can be useful, this script can potentially harm your computer. If you trust this script, use the
Unblock-File cmdlet to allow the script to run without this warning message. Do you want to run D:\apache-cassandra-3.11.9\bin\cassandra.ps1?
[D] Do not run  [R] Run once  [S] Suspend  [?] Help (default is "D"): R
......
省略
......

用root用户登录:

D:\apache-cassandra-3.11.9\bin>cqlsh.bat -uroot -pxxxxx

WARNING: console codepage must be set to cp65001 to support utf-8 encoding on Windows platforms.
If you experience encoding problems, change your console codepage with 'chcp 65001' before starting cqlsh.

Connected to Test Cluster at 127.0.0.1:9042.
[cqlsh 5.0.1 | Cassandra 3.11.9 | CQL spec 3.4.4 | Native protocol v4]
Use HELP for help.
WARNING: pyreadline dependency missing.  Install to enable tab completion.
root@cqlsh> use system_auth;
root@cqlsh:system_auth> select * from roles;

 role      | can_login | is_superuser | member_of | salted_hash
-----------+-----------+--------------+-----------+--------------------------------------------------------------
 cassandra |      True |         True |      null | $2a$10$6NGNXcEt26dk7mzqFxcONeuoZcBw2f5gZZwvksw7T1aFTcqd7hiYS
      root |      True |         True |      null | $2a$10$dYesaoFDUCeZnEiDIije/ecy1t.23EgclNdFpW/IDo9W.xnnJE0aW

(2 rows)
root@cqlsh:system_auth> exit;
D:\apache-cassandra-3.11.9\bin>

参考

Stackoverflow:Cassandra Windows 10 Access Violation

<think>我们面对的是一个Java运行时环境(JRE)报告的错误:EXCEPTION_ACCESS_VIOLATION (0xc0000005)。这个错误发生在Sigar库(sigar-amd64-winnt.dll)中。Sigar是一个用于收集系统信息的库,Cassandra使用它来监控系统状态。 ### 错误分析 1. **错误类型**:`EXCEPTION_ACCESS_VIOLATION` 通常表示程序试图访问它没有权限的内存地址。这可能是由于: - 内存损坏 - 有缺陷的本地库(如Sigar) - 不兼容的库版本 2. **环境信息**: - JRE:Zulu OpenJDK 8 (64位) - 操作系统:Windows(客户端版本,未启用核心转储) 3. **关键线索**:问题出现在 `sigar-amd64-winnt.dll` 中,这是Sigar的64位Windows版本。 ### 解决方案 #### 1. **更新或替换Sigar库** - 从[Sigar官方仓库](https://github.com/hyperic/sigar)下载最新版本的`libsigar-amd64-winnt.dll`(或检查Cassandra发行版中是否包含更新的版本) - 替换Cassandra的`lib`目录中的现有文件(通常位于`<Cassandra_HOME>\lib\sigar-bin\libsigar-amd64-winnt.dll`) #### 2. **禁用Sigar(如果不需要系统监控)** 在`cassandra.yaml`配置文件中禁用Sigar: ```yaml enable_sigar: false ``` 注意:禁用后,Cassandra将使用纯Java实现来收集系统指标,但某些功能(如精确的磁盘使用情况)可能受限。 #### 3. **检查Java版本兼容性** 虽然使用的是Zulu OpenJDK 8(官方支持版本),但可以尝试: - 升级到最新的Zulu OpenJDK 8补丁(例如当前最新是`8.0.462`,但可能有更新的补丁) - 或尝试使用其他JDK发行版(如AdoptOpenJDK、Amazon Corretto) #### 4. **检查系统环境** - 运行`sfc /scannow`命令检查系统文件完整性 - 确保没有其他程序干扰(如安全软件阻止内存访问) #### 5. **分析错误日志** 检查`C:\Windows\System32\hs_err_pid10532.log`文件,寻找: - 崩溃时的线程堆栈 - 加载的DLL列表 - 内存映射信息 ### 临时规避措施 如果问题持续,可以尝试使用Cassandra的启动参数避免加载Sigar: ```powershell bin\cassandra.bat -Dcassandra.boot_without_sigar=true ``` ### 预防建议 ```mermaid graph TD A[启动Cassandra] --> B{是否发生Sigar错误?} B -->|是| C[更新或禁用Sigar] B -->|否| D[正常启动] C --> E[验证修复] E -->|成功| F[记录解决方案] E -->|失败| G[分析hs_err_pid日志] ``` --- §§相关问题§§ 1. 如何确定Cassandra当前使用的Sigar库版本? 2. 在禁用Sigar后,Cassandra的哪些监控指标会受到影响? 3. 除了Sigar之外,还有哪些替代库可以用于在Windows上获取系统指标? 4. 如何配置Cassandra以生成完整的核心转储(core dump)文件用于调试? 5. 在Linux系统上遇到类似的本地库崩溃错误,应该如何排查?</think>### Cassandra JVM "EXCEPTION_ACCESS_VIOLATION" 错误解决方案 #### 错误原因分析 ```mermaid graph TD A[EXCEPTION_ACCESS_VIOLATION] --> B(Sigar 库问题) A --> C(JVM 内存冲突) A --> D(硬件兼容性问题) B --> B1[损坏的 sigar-amd64-winnt.dll] B --> B2[版本不兼容] C --> C1[内存地址冲突] C --> C2[垃圾回收器冲突] D --> D1[有缺陷的RAM] D --> D2[CPU虚拟化问题] ``` #### 解决步骤 **1. 替换 SIGAR 库文件** - 下载最新版 SIGAR 库: ```powershell Invoke-WebRequest -Uri "https://repo1.maven.org/maven2/org/fusesource/sigar/1.6.4/sigar-1.6.4.zip" -OutFile "sigar.zip" Expand-Archive -Path "sigar.zip" -DestinationPath . Copy-Item "sigar-bin\lib\sigar-amd64-winnt.dll" "C:\cassandra\lib\sigar-bin\" ``` **2. 修改 JVM 启动参数** 在 `conf/jvm.options` 添加: ```ini # 禁用有问题的内存页访问 -XX:-UseCompressedOops -XX:-UseCompressedClassPointers # 改用 G1 垃圾回收器 -XX:+UseG1GC ``` **3. 执行内存诊断** ```powershell # 检查内存错误 mdsched.exe /test # 验证系统文件完整性 sfc /scannow ``` **4. 创建 JVM 崩溃分析报告** 在 `conf/cassandra-env.sh` 添加: ```bash JVM_OPTS="$JVM_OPTS -XX:+CrashOnOutOfMemoryError" JVM_OPTS="$JVM_OPTS -XX:ErrorFile=C:/cassandra/logs/hs_err_pid%p.log" ``` **5. 临时禁用 SIGAR(测试用)** 启动时添加参数: ```powershell bin\cassandra.bat -Dcassandra.boot_without_sigar=true ``` #### 预防措施 1. **硬件检查**: - 定期运行 `memtest86+` - 禁用 CPU 超频 2. **环境隔离**: ```powershell # 设置专用运行账户 New-LocalUser -Name "cassandra_svc" -Password (ConvertTo-SecureString "P@ssw0rd!" -AsPlainText -Force) ``` 3. **版本兼容性矩阵**: | 组件 | 推荐版本 | 危险版本 | |---|---|----| | JVM | Zulu 8.0.382 | Zulu 8.0.462 | | SIGAR | 1.6.4 | <1.6.0 | | OS | Windows Server 2022 | Windows 10 Home | > ⚠️ **关键提示**:检查 `hs_err_pid10532.log` 中的 `EXCEPTION_ACCESS_VIOLATION` 地址值,若以 `0x1` 开头通常是 JVM 内部错误,以 `0x0` 开头则是空指针异常 ---
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值