DogLooksGood / emacs-rime

RIME ㄓ in Emacs
GNU General Public License v3.0
478 stars 68 forks source link

Crash when exit emacs #161

Open pluswu opened 3 years ago

pluswu commented 3 years ago

问题描述 spaceemacs关闭SPC qq 退出时如果有激活rime会必定crash(linux manjaro)同样的配置 我另外一台ubuntu20.04貌似就没问题... 简明的问题描述堆栈如下 acktrace: emacs(+0x148065)[0x558151b9b065] emacs(+0x4089c)[0x558151a9389c] emacs(+0x40dc3)[0x558151a93dc3] emacs(+0x14604e)[0x558151b9904e] emacs(+0x1460ca)[0x558151b990ca] /usr/lib/libpthread.so.0(+0x13960)[0x7f6d5a99a960] /usr/lib/librime.so.1(_ZN4rime4PoetD2Ev+0x28)[0x7f6d437381e8] /usr/lib/librime.so.1(_ZN4rime16ScriptTranslatorD0Ev+0x35)[0x7f6d43751ff5] /usr/lib/librime.so.1(_ZNSt16_Sp_counted_baseILN9__gnu_cxx12_Lock_policyE2EE10_M_releaseEv+0x3a)[0x7f6d4365033a] /usr/lib/librime.so.1(_ZN4rime14ConcreteEngineD1Ev+0x17f)[0x7f6d4366b2ff] /usr/lib/librime.so.1(_ZN4rime14ConcreteEngineD0Ev+0xa)[0x7f6d4366b3fa] /usr/lib/librime.so.1(_ZN4rime7Service18CleanupAllSessionsEv+0x8a)[0x7f6d43682d8a] /usr/lib/librime.so.1(_ZN4rime7ServiceD2Ev+0x13)[0x7f6d43682df3] /usr/lib/librime.so.1(_ZNSt10unique_ptrIN4rime7ServiceESt14default_deleteIS1_EED2Ev+0x12)[0x7f6d43685a82] /usr/lib/libc.so.6(+0x3f697)[0x7f6d5a621697] /usr/lib/libc.so.6(+0x3f83e)[0x7f6d5a62183e]

Emacs中的配置

  (setq rime-user-data-dir "~/.emacs.d/private/emacs-config/rime")
  (setq default-input-method "rime")
  (setq rime-show-candidate 'popup)

复现方式(安装遇到问题时省略)

复现问题所需的操作

是否可在 emacs -Q 中复现

是/否

截图

展示错误的截图或动图

环境信息 Manjaro, 27.2 , librime-20210207.1432

DogLooksGood commented 3 years ago

我也用 ArchLinux 和 Manjaro, 如果把 librime 换成 1:1.7.3-1 的版本呢?(当前仓库中的版本)

pluswu commented 3 years ago

有看了下 librime是1.7.3-1 原来好像没有安装这个库? 我新安装了之后还是会crash

tianshu @.***> 于2021年5月11日周二 上午9:59写道:

我也用 ArchLinux 和 Manjaro, 如果把 librime 换成 1:1.7.3-1 的版本呢?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/DogLooksGood/emacs-rime/issues/161#issuecomment-837635468, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAI6A7YXRNVSOSCRWITQUXTTNCFQ5ANCNFSM44RFJ4PQ .

DogLooksGood commented 3 years ago

如果能提供可以稳定重现的最小配置的话,应该会很有帮助。

tarlaw commented 3 years ago

我也遇到这个问题,Arch Linux librime 1.7.3

用HOME变量新开emacs环境,什么都不用配置,直接在melpa里安装rime,然后用Ctrl-\切换到rime再退出就会报错

HOME=~/Projects/emacs-test emacs

报错信息

$HOME=~/Projects/emacs-test emacs
Fatal error 11: Segmentation violation
Backtrace:
emacs(+0x148065)[0x56443bc81065]
emacs(+0x4089c)[0x56443bb7989c]
emacs(+0x40dc3)[0x56443bb79dc3]
emacs(+0x14604e)[0x56443bc7f04e]
emacs(+0x1460ca)[0x56443bc7f0ca]
/usr/lib/libpthread.so.0(+0x13870)[0x7f486dd89870]
/usr/lib/librime.so.1(_ZN4rime4PoetD2Ev+0x28)[0x7f485a8ea1e8]
/usr/lib/librime.so.1(_ZN4rime16ScriptTranslatorD0Ev+0x35)[0x7f485a903ff5]
/usr/lib/librime.so.1(_ZNSt16_Sp_counted_baseILN9__gnu_cxx12_Lock_policyE2EE10_M_releaseEv+0x3a)[0x7f485a80233a]
/usr/lib/librime.so.1(_ZN4rime14ConcreteEngineD1Ev+0x17f)[0x7f485a81d2ff]
/usr/lib/librime.so.1(_ZN4rime14ConcreteEngineD0Ev+0xa)[0x7f485a81d3fa]
/usr/lib/librime.so.1(_ZN4rime7Service18CleanupAllSessionsEv+0x8a)[0x7f485a834d8a]
/usr/lib/librime.so.1(_ZN4rime7ServiceD2Ev+0x13)[0x7f485a834df3]
/usr/lib/librime.so.1(_ZNSt10unique_ptrIN4rime7ServiceESt14default_deleteIS1_EED2Ev+0x12)[0x7f485a837a82]
/usr/lib/libc.so.6(+0x3f4a7)[0x7f486da0f4a7]
/usr/lib/libc.so.6(+0x3f64e)[0x7f486da0f64e]
emacs(+0x40824)[0x56443bb79824]
emacs(+0x1aab83)[0x56443bce3b83]
emacs(+0x1e3b89)[0x56443bd1cb89]
emacs(+0x1aaabf)[0x56443bce3abf]
emacs(+0x1e3b89)[0x56443bd1cb89]
emacs(+0x1aaabf)[0x56443bce3abf]
emacs(+0x1a7213)[0x56443bce0213]
emacs(+0x1aab83)[0x56443bce3b83]
emacs(+0x1a86be)[0x56443bce16be]
emacs(+0x1aab83)[0x56443bce3b83]
emacs(+0x1e3b89)[0x56443bd1cb89]
emacs(+0x1aaabf)[0x56443bce3abf]
emacs(+0x1aac3a)[0x56443bce3c3a]
emacs(+0x13c550)[0x56443bc75550]
emacs(+0x1a9cd7)[0x56443bce2cd7]
emacs(+0x12d155)[0x56443bc66155]
emacs(+0x1a9c32)[0x56443bce2c32]
emacs(+0x12d0ed)[0x56443bc660ed]
emacs(+0x1326eb)[0x56443bc6b6eb]
emacs(+0x132a14)[0x56443bc6ba14]
emacs(+0x48dfc)[0x56443bb81dfc]
/usr/lib/libc.so.6(__libc_start_main+0xd5)[0x7f486d9f7b25]
emacs(+0x4954e)[0x56443bb8254e]
Segmentation fault (core dumped)

.emacs配置:

(require 'package)
(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/"))
(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(package-selected-packages '(rime)))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 )
wsw0108 commented 3 years ago

自己编译了1.7.1,1.7.2,最小配置都没有崩溃的问题, 本来以为自己编译1.7.3,会复现问题,结果,依然没问题。 以上编译都是直接librime源码下make。 然后emacs-rime的Makefile固定rpath到指定路径。

但是只要是链接到系统(Arch)的1.7.3-1,就必然崩溃。。。

已经定位到是这个 https://github.com/rime/librime/issues/431 的提交引入的。 具体来说就是这行 https://github.com/rime/librime/blob/a1203fce1ebca70cc04b964d136ae6c4331708e5/Makefile#L46 -DENABLE_EXTERNAL_PLUGINS=ON,可能是什么PIC导致的,望有高手解答。 如果用make merged-plugins就不会crash了。

更新: 也与这个提交不太相关,与arch打包进去的插件octagram有关,从/usr/lib/rime-plugins里删除这个插件后,正常退出。 单独或全部保留其他插件,都可以正常退出。 只保留或包含这个插件,就必然退出崩溃。

wangwb98 commented 2 years ago

用spacemacs碰到了同样的问题,谢谢 @wsw0108 的信息,最后我采用的fix 方式是用下面代码来确保在exit emacs 之前先清理rime lib session 等。有需要的朋友可以参考。

(add-hook 'kill-emacs-hook #'rime-lib-finalize)

DogLooksGood commented 2 years ago

看起来可以把这个处理加在 emacs-rime 中。

1nj0k commented 2 months ago

在 Arch linux 上 librime 1:1.11.1-2,emacs-wayland 29.4,spacemacs 再次出现这种情况

上边 add-hook 的方法依然有效,我在 add-hook 前还加了

(defun rime-lib-finalize() nil)

防止不启用 emacs-rime 时弹出 void function 的警告

coredump message

Message: Process 6037 (emacs) of user 1000 dumped core.

                Stack trace of thread 6037:
                #0  0x000073a29953d3f4 n/a (libc.so.6 + 0x963f4)
                #1  0x000073a2994e4120 raise (libc.so.6 + 0x3d120)
                #2  0x00005a4146b80af0 n/a (emacs-29.4 + 0x1faf0)
                #3  0x00005a4146b81bea n/a (emacs-29.4 + 0x20bea)
                #4  0x00005a4146e0c335 n/a (emacs-29.4 + 0x2ab335)
                #5  0x000073a2994e41d0 n/a (libc.so.6 + 0x3d1d0)
                #6  0x000073a27fddac90 n/a (librime.so.1 + 0x98c90)
                #7  0x000073a27fdd406b _ZN4rime14ConcreteEngineD1Ev (librime.so.1 + 0x9206b)
                #8  0x000073a27fdd40c6 _ZN4rime14ConcreteEngineD0Ev (librime.so.1 + 0x920c6)
                #9  0x000073a27fdbb58a n/a (librime.so.1 + 0x7958a)
                #10 0x000073a27fde583c _ZN4rime7Service18CleanupAllSessionsEv (librime.so.1 + 0xa383c)
                #11 0x000073a27fde9994 _ZN4rime7ServiceD1Ev (librime.so.1 + 0xa7994)
                #12 0x000073a27fde9a1e n/a (librime.so.1 + 0xa7a1e)
                #13 0x000073a2994e6891 n/a (libc.so.6 + 0x3f891)
                #14 0x000073a2994e695e exit (libc.so.6 + 0x3f95e)
                #15 0x00005a4146b8104a n/a (emacs-29.4 + 0x2004a)
                #16 0x00005a4146d2064d n/a (emacs-29.4 + 0x1bf64d)
                #17 0x00005a4146d21510 n/a (emacs-29.4 + 0x1c0510)
                #18 0x00005a4146d22894 n/a (emacs-29.4 + 0x1c1894)
                #19 0x00005a4146d22aed n/a (emacs-29.4 + 0x1c1aed)
                #20 0x00005a4146d22656 n/a (emacs-29.4 + 0x1c1656)
                #21 0x00005a4146d2479d n/a (emacs-29.4 + 0x1c379d)
                #22 0x00005a4146d2064d n/a (emacs-29.4 + 0x1bf64d)
                #23 0x00005a4146d21510 n/a (emacs-29.4 + 0x1c0510)
                #24 0x00005a4146d758b8 n/a (emacs-29.4 + 0x2148b8)
                #25 0x00005a4146d2064d n/a (emacs-29.4 + 0x1bf64d)
                #26 0x000073a294e8edf9 F736176652d627566666572732d6b696c6c2d656d616373_save_buffers_kill_emacs_0 (files-1e8937b2-592f65e7.eln + 0x30df9)
                #27 0x00005a4146d2064d n/a (emacs-29.4 + 0x1bf64d)
                #28 0x00005a4146d216e8 n/a (emacs-29.4 + 0x1c06e8)
                #29 0x00005a4146d22894 n/a (emacs-29.4 + 0x1c1894)
                #30 0x00005a4146d22aed n/a (emacs-29.4 + 0x1c1aed)
                #31 0x00005a4146d22656 n/a (emacs-29.4 + 0x1c1656)
                #32 0x00005a4146d2479d n/a (emacs-29.4 + 0x1c379d)
                #33 0x00005a4146d2064d n/a (emacs-29.4 + 0x1bf64d)
                #34 0x00005a4146d216e8 n/a (emacs-29.4 + 0x1c06e8)
                #35 0x00005a4146d758b8 n/a (emacs-29.4 + 0x2148b8)
                #36 0x00005a4146d2064d n/a (emacs-29.4 + 0x1bf64d)
                #37 0x000073a294fcd560 F68616e646c652d64656c6574652d6672616d65_handle_delete_frame_0 (frame-b40fc590-ee8c57f1.eln + 0x5560)
                #38 0x00005a4146d2064d n/a (emacs-29.4 + 0x1bf64d)
                #39 0x00005a4146d2075b n/a (emacs-29.4 + 0x1bf75b)
                #40 0x00005a4146d2064d n/a (emacs-29.4 + 0x1bf64d)
                #41 0x00005a4146d26809 n/a (emacs-29.4 + 0x1c5809)
                #42 0x000073a2981ae6a5 F636f6d6d616e642d65786563757465_command_execute_0 (simple-fab5b0cf-7c10fc4e.eln + 0x1d6a5)
                #43 0x00005a4146d2064d n/a (emacs-29.4 + 0x1bf64d)
                #44 0x00005a4146c8a20a n/a (emacs-29.4 + 0x12920a)
                #45 0x00005a4146c9eae3 n/a (emacs-29.4 + 0x13dae3)
                #46 0x00005a4146c84a8f n/a (emacs-29.4 + 0x123a8f)
                #47 0x00005a4146d1e14e n/a (emacs-29.4 + 0x1bd14e)
                #48 0x00005a4146c80ba6 n/a (emacs-29.4 + 0x11fba6)
                #49 0x00005a4146d1e0a8 n/a (emacs-29.4 + 0x1bd0a8)
                #50 0x00005a4146c8480b n/a (emacs-29.4 + 0x12380b)
                #51 0x00005a4146e224bf n/a (emacs-29.4 + 0x2c14bf)
                #52 0x00005a4146c8693d n/a (emacs-29.4 + 0x12593d)
                #53 0x00005a4146b93301 n/a (emacs-29.4 + 0x32301)
                #54 0x000073a2994cce08 n/a (libc.so.6 + 0x25e08)
                #55 0x000073a2994ccecc __libc_start_main (libc.so.6 + 0x25ecc)
                #56 0x00005a4146b94975 n/a (emacs-29.4 + 0x33975)

                Stack trace of thread 6040:
                #0  0x000073a2995be1fd syscall (libc.so.6 + 0x1171fd)
                #1  0x000073a29cdc1367 g_cond_wait_until (libglib-2.0.so.0 + 0xb8367)
                #2  0x000073a29cd2e8d5 n/a (libglib-2.0.so.0 + 0x258d5)
                #3  0x000073a29cd2ea48 g_async_queue_timeout_pop (libglib-2.0.so.0 + 0x25a48)
                #4  0x000073a29cd9b0b0 n/a (libglib-2.0.so.0 + 0x920b0)
                #5  0x000073a29cd95266 n/a (libglib-2.0.so.0 + 0x8c266)
                #6  0x000073a29953b39d n/a (libc.so.6 + 0x9439d)
                #7  0x000073a2995c049c n/a (libc.so.6 + 0x11949c)

                Stack trace of thread 6038:
                #0  0x000073a2995be1fd syscall (libc.so.6 + 0x1171fd)
                #1  0x000073a29cdc0a10 g_cond_wait (libglib-2.0.so.0 + 0xb7a10)
                #2  0x000073a29cd2e90c n/a (libglib-2.0.so.0 + 0x2590c)
                #3  0x000073a29cd9a6b7 n/a (libglib-2.0.so.0 + 0x916b7)
                #4  0x000073a29cd95266 n/a (libglib-2.0.so.0 + 0x8c266)
                #5  0x000073a29953b39d n/a (libc.so.6 + 0x9439d)
                #6  0x000073a2995c049c n/a (libc.so.6 + 0x11949c)

                Stack trace of thread 6043:
                #0  0x000073a2995be1fd syscall (libc.so.6 + 0x1171fd)
                #1  0x000073a29cdc0a10 g_cond_wait (libglib-2.0.so.0 + 0xb7a10)
                #2  0x000073a29cd2e90c n/a (libglib-2.0.so.0 + 0x2590c)
                #3  0x000073a29cd2e97d g_async_queue_pop (libglib-2.0.so.0 + 0x2597d)
                #4  0x000073a29bcb45fc n/a (libpangoft2-1.0.so.0 + 0xc5fc)
                #5  0x000073a29cd95266 n/a (libglib-2.0.so.0 + 0x8c266)
                #6  0x000073a29953b39d n/a (libc.so.6 + 0x9439d)
                #7  0x000073a2995c049c n/a (libc.so.6 + 0x11949c)

                Stack trace of thread 6041:
                #0  0x000073a2995b263d __poll (libc.so.6 + 0x10b63d)
                #1  0x000073a29cdc792d n/a (libglib-2.0.so.0 + 0xbe92d)
                #2  0x000073a29cd64fc5 g_main_context_iteration (libglib-2.0.so.0 + 0x5bfc5)
                #3  0x000073a2949e82fe n/a (libdconfsettings.so + 0x62fe)
                #4  0x000073a29cd95266 n/a (libglib-2.0.so.0 + 0x8c266)
                #5  0x000073a29953b39d n/a (libc.so.6 + 0x9439d)
                #6  0x000073a2995c049c n/a (libc.so.6 + 0x11949c)

                Stack trace of thread 6039:
                #0  0x000073a2995b263d __poll (libc.so.6 + 0x10b63d)
                #1  0x000073a29cdc792d n/a (libglib-2.0.so.0 + 0xbe92d)
                #2  0x000073a29cd64fc5 g_main_context_iteration (libglib-2.0.so.0 + 0x5bfc5)
                #3  0x000073a29cd6501a n/a (libglib-2.0.so.0 + 0x5c01a)
                #4  0x000073a29cd95266 n/a (libglib-2.0.so.0 + 0x8c266)
                #5  0x000073a29953b39d n/a (libc.so.6 + 0x9439d)
                #6  0x000073a2995c049c n/a (libc.so.6 + 0x11949c)

                Stack trace of thread 6042:
                #0  0x000073a2995b263d __poll (libc.so.6 + 0x10b63d)
                #1  0x000073a29cdc792d n/a (libglib-2.0.so.0 + 0xbe92d)
                #2  0x000073a29cd667b7 g_main_loop_run (libglib-2.0.so.0 + 0x5d7b7)
                #3  0x000073a29cfc8574 n/a (libgio-2.0.so.0 + 0x112574)
                #4  0x000073a29cd95266 n/a (libglib-2.0.so.0 + 0x8c266)
                #5  0x000073a29953b39d n/a (libc.so.6 + 0x9439d)
                #6  0x000073a2995c049c n/a (libc.so.6 + 0x11949c)
                ELF object binary architecture: AMD x86-64