-
-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
brew-installed on mac intermittently segfaults #391
Comments
Thanks for the report, sorry to hear about this frustrating problem. The most likely candidate for segfaults, given the symptoms, is the AppleSpell backend. Unfortunately I can't test this much, as I don't have macOS. I will of course be delighted to receive improved tests, which I can run in CI, to help me avoid introducing bugs, fixes for bugs I may have introduced, and paid commissions to improve macOS support (or indeed Windows, where we currently don't support the native back-end). The obvious alternative, in the absence of help and the continuation of bug reports, would be to give up on AppleSpell support and simply remove it. The stuff about finding dictionaries is annoying. I have attempted to improve both functionality and documentation in this area in recent releases. This is a partly a fundamental weakness of Enchant's design: as it delegates to other spelling providers, some of the details of how they work leaks out. Partly, the problem until recently has been that Enchant was insufficiently uniform in its treatment of back-ends. This I have recently improved considerably, and documented the remaining differences. The problems with I can't help directly with packaging, that's simply beyond the scope of Enchant per se. I need bug reports about building Enchant from source. Again, I sympathise with users trying to work out whether a problem is ultimately caused by the packaging or by upstream, and I know that different packaging systems put different amounts of effort in and have different levels of resources for fixing problems with packaging. Jinx seems to have brought the largest number of new users to Enchant for many years, which is great. However, it has also resulted in a lot of confusion and frustration, largely because it exposes users more directly to Enchant. (Most other uses of Enchant are insulated behind an app or framework that have their own configuration.) Some of this I have addressed by improved documentation and better debugging facilities for users; but in other areas (bug fixes, functionality improvement, and the rewrite in Vala) there is unavoidable churn and new bugs, which will of course mean that new problems emerge; and with Enchant they are often frustratingly similar to old problems. Also recently I have introduced one piece of major new functionality, composite dictionaries. The good news as of now is that I don't plan further major changes to the library any time soon (the currently open issues that I'm most likely to work on are for the command-line commands). So stability and documentation should improve in the short term, as long as I get actionable bug reports. |
To progress this particular issue, I'm afraid I'll need something I can work with without needing to use brew or macOS. I'm happy to leave it for other users, but "a particular downstream packaging of Enchant crashes in some configurations on a proprietary OS" is not something I'm prepared to spend unpaid time on. |
I heartily appreciate your lengthy, detailed explanations, and I apologize for making you spend time on this. Of course, it's never my desire to waste your time, especially as you explained the issue is with AppleSpell. Unfortunately, I myself have a very shallow understanding of how Enchant works; just like I said, never before did it give me any trouble on my Linux machine; otherwise, I would love to try to be more helpful here. I solved the problem for myself by compiling it from the tarball; it now works as delightfully as always. I just thought it would be a good idea to raise awareness so others wouldn't have to waste their time plucking their eyebrows like I had to do. Thank you, Ruben, for such an amazing craft. I'm very happy that I was able to isolate the problem and fix it, and to a certain degree, I'm glad this has happened. I never before thought about how important this piece of software is for my comfortable well-being. If there's nothing else to do here, please feel free to close this. Thanks! |
Thanks, @agzam, I'm happy to leave this issue open for now in case anyone wants to work on the brew packaging and perhaps isolate the underlying problem here, whether it's in the packaged build or in the upstream code. |
@rrthomas I just linked an issue which may be related, but I’ve not investigated more thoroughly. |
Thanks, @jenstroeger, I think this is looking more and more like a bug in the AppleSpell provider, which I am minded to deprecate and ask for help with. |
@rrthomas regarding your comment pyenchant/pyenchant#321 (comment)
Happy to help with whatever you need, just let me know! I’ve got the native enchant lib installed:
I renamed the >>> import enchant
>>> b = enchant.Broker()
>>> b.set_ordering("*", "nuspell,hunspell,myspell,aspell")
>>> b.describe()
[<Enchant: Hunspell Provider>] and then the problem in issue pyenchant/pyenchant#321 didn’t occur: >>> b.dict_exists('ar')
False
>>> b.request_dict('ar') # I can repeat this any number of times without segfault now.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/path/to/.venv/lib/python3.10/site-packages/enchant/__init__.py", line 272, in request_dict
return Dict(tag, self)
File "/path/to/.venv/lib/python3.10/site-packages/enchant/__init__.py", line 542, in __init__
super().__init__()
File "/path/to/.venv/lib/python3.10/site-packages/enchant/__init__.py", line 144, in __init__
self._init_this()
File "/path/to/.venv/lib/python3.10/site-packages/enchant/__init__.py", line 549, in _init_this
this = self._broker._request_dict_data(self.tag)
File "/path/to/.venv/lib/python3.10/site-packages/enchant/__init__.py", line 287, in _request_dict_data
self._raise_error(e_str % (tag,), DictNotFoundError)
File "/path/to/.venv/lib/python3.10/site-packages/enchant/__init__.py", line 233, in _raise_error
raise eclass(default)
enchant.errors.DictNotFoundError: Dictionary for language 'ar' could not be found
Please check https://pyenchant.github.io/pyenchant/ for details Let me know what you’d like me to run to capture a segfault stack trace! |
@jenstroger, many thanks, that's already pretty strong evidence. I don't know how to get backtraces from segfaults on macOS; on Linux I'd use gdb on a core dump. I just tried searching "segfault backtrace macos" and found https://stackoverflow.com/questions/8370468/debugging-segmentation-faults-on-a-mac but if this is more trouble than you're willing to go to, then don't worry! I think I'll go ahead with deprecating the AppleSpell backend pending finding a maintainer for it (or a sponsor for me!), in any case. |
@jenstroeger On second thoughts, I had a quick look at the AppleSpell back-end, and I think I failed to update it properly for the recent rework of the internal provider API. I have, I believe, now fixed it. If you can possibly test it from git, I would be most grateful. Otherwise, I will make a release and see what happens when it makes it into brew. If I haven't improved things, it will be time to deprecate it and await help! |
I’m happy to run through this, I spent years noodling on that level of code 🤓
Sure, any particular branch you want me to pull from? |
@jenstroger, many thanks! Please use |
@rrthomas I don’t see a |
@jenstroeger Apologies, I meant |
Ah thank you @rrthomas, now I see commit 06c9166 🤓 FWIW, we’re not quite there yet and the Python test script still crashes. However, and for future reference, here are the steps I took to obtain the stack trace on Mac:
And here’s the stack trace you asked for:
I suppose if we’d recompile with debug symbols then it would make reading the stack trace a little easier. Meanwhile, the offending function seems to be this one (using
Does this help somewhat? Footnotes |
Thanks very much for this. It would be great if you could repeat with debug symbols to give source line numbers and parameter values. The stack trace you give is not a big surprise, but I can't see what's going wrong exactly. |
I didn’t see it documented and
doesn’t seem to work — currently this still compiles with |
There shouldn't be any need to change |
That makes sense and Having said that, the above steps only replace the AppleSpell lib and still run the original MacPorts |
I'm sorry, I had another look and I can't spot anything obviously wrong with the way you're trying to get debug info. On Linux, building with You might do better to install from source (in a location of your choice) and use that, as you say. It will be less likely to give confusing results. Thanks for your continued efforts! |
@rrthomas I’ve not forgotten, currently traveling. I hope to pick this up this coming weekend. Also, shall we continue this discussion over on issue https://github.com/AbiWord/enchant/issues/392 which seems more related to the investigation than this one? |
Thanks, @jenstroeger, closing this issue in favour of #392. |
To properly destruct an EnchantDict, its session field must be non-null since the destructor assumes a session has been associated with the object. This association happens in EnchantBroker when a provider upon request finds a valid dictionary and in doing so creates an EnchantDict object which is returned to the broker. In the AppleSpell provider, the EnchantDict was created regardless of whether the provider would be able to find a valid dictionary or not. If it did not find a valid dictionary, it would erroneously free the EnchantDict object and return null, despite the leaving the EnchantDict in the broker's set of dictionaries. This commit fixes the issue by moving the creation of the EnchantDict to occur after successfully finding a valid dictionary. Fixes rrthomas#391
enchant that continues to work delightfully on my Linux machine, recently was a source of some frustration on a Mac.
see the details in this r/emacs post
I'm not sure what exactly causes that, but it seems there's a difference between brew-installed (with default options) and manually-built from the tarball, even though the versions are the same. I checked the formula and couldn't spot anything wrong.
The text was updated successfully, but these errors were encountered: