Stack Overflow #609

Open
opened 2025-10-07 11:03:04 +02:00 by xmo · 4 comments
Contributor

I don't really have a minimal repro case, but on $DAYJOB's repo mergiraf triggers a stack overflow on a specific merge:

$ git -c merge.conflictStyle=diff3 -c merge.mergiraf.name=mergiraf -c merge.mergiraf.driver="mergiraf merge --git %O %A %B -s %S -x %X -y %Y -p %P -l %L" -c core.attributesfile=$attrfile merge-tree --merge-base 430ee4506797413bef8837b3538f6dbd64e1c353~1 99f8190e11bfff38eaaee569ed895484bfce7589 430ee4506797413bef8837b3538f6dbd64e1c353

thread '<unknown>' has overflowed its stack
fatal runtime error: stack overflow, aborting
Aborted (core dumped)
fatal: failure to merge

$attrfile is just a path to a file which contains

* merge=mergiraf

as merging using mergiraf can be enabled and disabled dynamically, so it's not part of the repository's "static" configuration.

As the repository is a bit of a chonker here should be the fastest / easiest way to get a working local version for this (tested on ZSH but I don't think it has any zsh-ism?):

$ git clone --bare --filter=tree:0 -b 19.0 https://github.com/odoo/odoo
$ cd odoo.git
$ git fetch origin 99f8190e11bfff38eaaee569ed895484bfce7589
$ echo '* merge=mergiraf\n' > attrfile
$ export attrfile=$(pwd)/attrfile

At this point:

$ git merge-tree --merge-base 430ee4506797413bef8837b3538f6dbd64e1c353~1 99f8190e11bfff38eaaee569ed895484bfce7589 430ee4506797413bef8837b3538f6dbd64e1c353
e8d801a221c51e2822dd467548ad1a043a9fe5aa
<bunch of noises as git needs to retrieve the trees and blobs it requires to merge stuff>
100644 0116d98570c99c2bc6df9fca083670ac53e49252 1	addons/mail/static/tests/emoji/emoji.test.js
100644 07caed9b820f56f09dcb7a419286d6bb2eb43247 2	addons/mail/static/tests/emoji/emoji.test.js
100644 debe2f050abbbbc34782937d2af7e7a69544bf08 3	addons/mail/static/tests/emoji/emoji.test.js
100644 172ea708a9d23074dbbff823a67231f1adea4835 1	addons/web/static/src/core/emoji_picker/emoji_data.js
100644 b090be6b4a7f33fe65eeea9ebe31192f4572eb83 2	addons/web/static/src/core/emoji_picker/emoji_data.js
100644 7dd23224dbb3115d5dd388a69f89ddd4f90f26f7 3	addons/web/static/src/core/emoji_picker/emoji_data.js

Auto-merging addons/mail/static/tests/emoji/emoji.test.js
CONFLICT (content): Merge conflict in addons/mail/static/tests/emoji/emoji.test.js
Auto-merging addons/web/static/src/core/emoji_picker/emoji_data.js
CONFLICT (content): Merge conflict in addons/web/static/src/core/emoji_picker/emoji_data.js
$ git -c merge.conflictStyle=diff3 -c merge.mergiraf.name=mergiraf -c merge.mergiraf.driver="mergiraf merge --git %O %A %B -s %S -x %X -y %Y -p %P -l %L" -c core.attributesfile=$attrfile merge-tree --merge-base 430ee4506797413bef8837b3538f6dbd64e1c353~1 99f8190e11bfff38eaaee569ed895484bfce7589 430ee4506797413bef8837b3538f6dbd64e1c353

thread '<unknown>' has overflowed its stack
fatal runtime error: stack overflow, aborting
Aborted (core dumped)
fatal: failure to merge

This is with

$ mergiraf --version
mergiraf 0.15.0
I don't really have a minimal repro case, but on $DAYJOB's repo mergiraf triggers a stack overflow on a specific merge: ``` $ git -c merge.conflictStyle=diff3 -c merge.mergiraf.name=mergiraf -c merge.mergiraf.driver="mergiraf merge --git %O %A %B -s %S -x %X -y %Y -p %P -l %L" -c core.attributesfile=$attrfile merge-tree --merge-base 430ee4506797413bef8837b3538f6dbd64e1c353~1 99f8190e11bfff38eaaee569ed895484bfce7589 430ee4506797413bef8837b3538f6dbd64e1c353 thread '<unknown>' has overflowed its stack fatal runtime error: stack overflow, aborting Aborted (core dumped) fatal: failure to merge ``` `$attrfile` is just a path to a file which contains * merge=mergiraf as merging using mergiraf can be enabled and disabled dynamically, so it's not part of the repository's "static" configuration. As the repository is a bit of a chonker here should be the fastest / easiest way to get a working local version for this (tested on ZSH but I don't think it has any zsh-ism?): ```sh $ git clone --bare --filter=tree:0 -b 19.0 https://github.com/odoo/odoo $ cd odoo.git $ git fetch origin 99f8190e11bfff38eaaee569ed895484bfce7589 $ echo '* merge=mergiraf\n' > attrfile $ export attrfile=$(pwd)/attrfile ``` At this point: ```sh $ git merge-tree --merge-base 430ee4506797413bef8837b3538f6dbd64e1c353~1 99f8190e11bfff38eaaee569ed895484bfce7589 430ee4506797413bef8837b3538f6dbd64e1c353 e8d801a221c51e2822dd467548ad1a043a9fe5aa <bunch of noises as git needs to retrieve the trees and blobs it requires to merge stuff> 100644 0116d98570c99c2bc6df9fca083670ac53e49252 1 addons/mail/static/tests/emoji/emoji.test.js 100644 07caed9b820f56f09dcb7a419286d6bb2eb43247 2 addons/mail/static/tests/emoji/emoji.test.js 100644 debe2f050abbbbc34782937d2af7e7a69544bf08 3 addons/mail/static/tests/emoji/emoji.test.js 100644 172ea708a9d23074dbbff823a67231f1adea4835 1 addons/web/static/src/core/emoji_picker/emoji_data.js 100644 b090be6b4a7f33fe65eeea9ebe31192f4572eb83 2 addons/web/static/src/core/emoji_picker/emoji_data.js 100644 7dd23224dbb3115d5dd388a69f89ddd4f90f26f7 3 addons/web/static/src/core/emoji_picker/emoji_data.js Auto-merging addons/mail/static/tests/emoji/emoji.test.js CONFLICT (content): Merge conflict in addons/mail/static/tests/emoji/emoji.test.js Auto-merging addons/web/static/src/core/emoji_picker/emoji_data.js CONFLICT (content): Merge conflict in addons/web/static/src/core/emoji_picker/emoji_data.js $ git -c merge.conflictStyle=diff3 -c merge.mergiraf.name=mergiraf -c merge.mergiraf.driver="mergiraf merge --git %O %A %B -s %S -x %X -y %Y -p %P -l %L" -c core.attributesfile=$attrfile merge-tree --merge-base 430ee4506797413bef8837b3538f6dbd64e1c353~1 99f8190e11bfff38eaaee569ed895484bfce7589 430ee4506797413bef8837b3538f6dbd64e1c353 thread '<unknown>' has overflowed its stack fatal runtime error: stack overflow, aborting Aborted (core dumped) fatal: failure to merge ``` This is with ```sh $ mergiraf --version mergiraf 0.15.0 ```
Owner

Haven't looked into the code yet, but I'm pretty sure it's a bug in comment bundling we've introduced recently (see the first report of it here). @wetneb maybe we should temporarily introduce relevant cycle detection, as described here? It will slow down the program a bit of course, but I think that's preferable to outright panics

Haven't looked into the code yet, but I'm pretty sure it's a bug in comment bundling we've introduced recently (see the first report of it [here](https://codeberg.org/mergiraf/mergiraf/pulls/576#issuecomment-7028384)). @wetneb maybe we should temporarily introduce relevant cycle detection, as described [here](https://codeberg.org/mergiraf/mergiraf/pulls/576#issuecomment-7030316)? It will slow down the program a bit of course, but I think that's preferable to outright panics
Owner

That would be ideal - this sort of failure is one I would gladly avoid :)

That would be ideal - this sort of failure is one I would gladly avoid :)
Owner

Oh -- it turns out that if I add a debug-panic when a cycle is detected, then even some of our unit tests fail. That's kind of good news, because until now, I'd only seen panics on very large files, which would've been annoying to debug; but with this, I might even be able to find the root issue. Still, it might make sense to publish a hotfix release without the debug-panic for now

Oh -- it turns out that if I add a debug-panic when a cycle is detected, then even some of our unit tests fail. That's kind of good news, because until now, I'd only seen panics on very large files, which would've been annoying to debug; but with this, I might even be able to find the root issue. Still, it might make sense to publish a hotfix release without the debug-panic for now
Owner

Here's a reproducer for a stack overflow panic. Not sure if it's the same root cause, but it's worth tackling in any case :)

Here's a reproducer for a stack overflow panic. Not sure if it's the same root cause, but it's worth tackling in any case :)
Sign in to join this conversation.
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: mergiraf/mergiraf#609
No description provided.