Skip to content
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

seaf-server crashes during upload #1928

Closed
gicmo opened this issue Jul 1, 2017 · 5 comments
Closed

seaf-server crashes during upload #1928

gicmo opened this issue Jul 1, 2017 · 5 comments

Comments

@gicmo
Copy link

gicmo commented Jul 1, 2017

On the client I get:

[07/01/17 12:15:47] http-tx-mgr.c(1132): Transfer repo 'a427fe0e': ('normal', 'init') --> ('normal', 'check')
[07/01/17 12:15:47] http-tx-mgr.c(1132): Transfer repo 'a427fe0e': ('normal', 'check') --> ('normal', 'commit')
[07/01/17 12:15:47] http-tx-mgr.c(1132): Transfer repo 'a427fe0e': ('normal', 'commit') --> ('normal', 'fs')
[07/01/17 12:15:49] http-tx-mgr.c(2860): Bad response code for POST https://file.server/seafhttp/repo/a427fe0e-e266-4599-88e1-5d5d318e64e8/recv-fs/: 502.
[07/01/17 12:15:49] http-tx-mgr.c(3496): Failed to send fs objects for repo a427fe0e.
[07/01/17 12:15:49] http-tx-mgr.c(1132): Transfer repo 'a427fe0e': ('normal', 'fs') --> ('error', 'finished')
[07/01/17 12:15:49] sync-mgr.c(764): Repo 'Documents' sync state transition from uploading to 'error': 'Error occured in upload.'.

It seems the seaf-server is constantly crashing:

[...]
pid 4508 (seaf-server), uid 0: exited on signal 11 (core dumped)
pid 4522 (seaf-server), uid 0: exited on signal 11 (core dumped)
pid 4525 (seaf-server), uid 0: exited on signal 11 (core dumped)
pid 4529 (seaf-server), uid 0: exited on signal 11 (core dumped)
pid 4533 (seaf-server), uid 0: exited on signal 11 (core dumped)
pid 4536 (seaf-server), uid 0: exited on signal 11 (core dumped)
pid 4539 (seaf-server), uid 0: exited on signal 11 (core dumped)
pid 4552 (seaf-server), uid 0: exited on signal 11 (core dumped)

The logs doesn't seem to contain any interesting info
controller.log

/seafile.log -P /usr/local/www/haiwen/pids/seaf-server.pid
[07/01/17 12:14:47] seafile-controller.c(101): spawned seaf-server, pid 4538
[07/01/17 12:15:27] seafile-controller.c(473): seaf-server need restart...
[07/01/17 12:15:27] seafile-controller.c(199): starting seaf-server ...
[07/01/17 12:15:27] seafile-controller.c(86): spawn_process: seaf-server -F /usr/local/www/haiwen/conf -c /usr/local/www/haiwen/ccnet -d /silo/sea -l /usr/local/www/haiwen/logs/seafile.log -P /usr/local/www/haiwen/pids/seaf-server.pid
[07/01/17 12:15:27] seafile-controller.c(101): spawned seaf-server, pid 4551
[07/01/17 12:15:57] seafile-controller.c(473): seaf-server need restart...
[07/01/17 12:15:57] seafile-controller.c(199): starting seaf-server ...
[07/01/17 12:15:57] seafile-controller.c(86): spawn_process: seaf-server -F /usr/local/www/haiwen/conf -c /usr/local/www/haiwen/ccnet -d /silo/sea -l /usr/local/www/haiwen/logs/seafile.log -P /usr/local/www/haiwen/pids/seaf-server.pid
[07/01/17 12:15:57] seafile-controller.c(101): spawned seaf-server, pid 4564
[07/01/2017 12:14:17] ../common/mq-mgr.c(54): [mq client] mq cilent is started
[07/01/2017 12:14:47] ../common/mq-mgr.c(54): [mq client] mq cilent is started
[07/01/2017 12:15:27] ../common/mq-mgr.c(54): [mq client] mq cilent is started
[07/01/2017 12:15:57] ../common/mq-mgr.c(54): [mq client] mq cilent is started

Sadly the core file doesn't have debug symbols:

(gdb) bt
#0  0x0000000800ae3001 in ?? ()
Cannot access memory at address 0x7fffde3f0bf0

I wonder what file it is on the client that causes the crash, but the client log, or the client programs don't seem to say (or I am not looking in the right places).

@gicmo
Copy link
Author

gicmo commented Jul 1, 2017

Ah, forgot to give the system details:

FreeBSD hal.xatom.net 11.0-RELEASE-p1 FreeBSD 11.0-RELEASE-p1 #0 r306420: Thu Sep 29 01:43:23 UTC 2016     root@releng2.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC  amd64
# pkg info seafile-server
seafile-server-6.1.1

@killing
Copy link
Member

killing commented Jul 6, 2017

This could be a problem specific to BSD. We haven't had similar reports on the other platforms.

@shoeper shoeper closed this as completed Jun 5, 2018
@gicmo
Copy link
Author

gicmo commented Jun 6, 2018

This got closed because it is fixed or because BSD is not supported? Would be nice to get an a brief explanation on actions. Thanks ;)

@shoeper
Copy link
Collaborator

shoeper commented Jun 6, 2018

Because it is bsd.

I'm only a community member.
I think if you debug it and submit a pr that won't break other systems it could be merged but Seafile Ltd won't fix it.

@Ultima1252
Copy link

Ultima1252 commented Sep 1, 2019

This is due to a newer version of libevhtp. This behavior isn't in seafile that is bundled with the old version of libevhtp because it appeared after that point.

Newer versions of libevhtp will allocate to a buffer instead of the heap (older versions always use heap). Seafile can make a request that will cause a buffer overflow in libevhtp which is probably the error you are seeing here. (would need more debugging output to be positive)

A fix is to pass -DEVHTP_HAS_C99=false during the build which will force allocation to the heap instead of a buffer.

A fix will be added to FreeBSD ports shortly applying the above.

uqs pushed a commit to freebsd/freebsd-ports that referenced this issue Sep 1, 2019
libevhtp allocates a stack based on data length
when C99 is detected at compile time. There are
no checks to verify that the stack is big enough
which can cause a stack overflow.

Adding EVHTP_HAS_C99=false at compile time changes
this behavior by allocate to a buffer which has
proper checks in place.

More information about this bug can be found at:
Yellow-Camper/libevhtp#118
haiwen/seafile#1928

MFH:		2019Q3


git-svn-id: svn+ssh://svn.freebsd.org/ports/head@510747 35697150-7ecd-e111-bb59-0022644237b5
Jehops pushed a commit to Jehops/freebsd-ports-legacy that referenced this issue Sep 1, 2019
libevhtp allocates a stack based on data length
when C99 is detected at compile time. There are
no checks to verify that the stack is big enough
which can cause a stack overflow.

Adding EVHTP_HAS_C99=false at compile time changes
this behavior by allocate to a buffer which has
proper checks in place.

More information about this bug can be found at:
Yellow-Camper/libevhtp#118
haiwen/seafile#1928

MFH:		2019Q3


git-svn-id: svn+ssh://svn.freebsd.org/ports/head@510747 35697150-7ecd-e111-bb59-0022644237b5
uqs pushed a commit to freebsd/freebsd-ports that referenced this issue Sep 2, 2019
libevhtp allocates a stack based on data length
when C99 is detected at compile time. There are
no checks to verify that the stack is big enough
which can cause a stack overflow.

Adding EVHTP_HAS_C99=false at compile time changes
this behavior by allocate to a buffer which has
proper checks in place.

More information about this bug can be found at:
Yellow-Camper/libevhtp#118
haiwen/seafile#1928

MFH:		2019Q3
uqs pushed a commit to freebsd/freebsd-ports that referenced this issue Sep 2, 2019
Fix stack overflow that can occur in libevhtp

libevhtp allocates a stack based on data length
when C99 is detected at compile time. There are
no checks to verify that the stack is big enough
which can cause a stack overflow.

Adding EVHTP_HAS_C99=false at compile time changes
this behavior by allocate to a buffer which has
proper checks in place.

More information about this bug can be found at:
Yellow-Camper/libevhtp#118
haiwen/seafile#1928

Approved by:	ports-secteam (joneum)
uqs pushed a commit to freebsd/freebsd-ports that referenced this issue Apr 1, 2021
Fix stack overflow that can occur in libevhtp

libevhtp allocates a stack based on data length
when C99 is detected at compile time. There are
no checks to verify that the stack is big enough
which can cause a stack overflow.

Adding EVHTP_HAS_C99=false at compile time changes
this behavior by allocate to a buffer which has
proper checks in place.

More information about this bug can be found at:
Yellow-Camper/libevhtp#118
haiwen/seafile#1928

Approved by:	ports-secteam (joneum)
svmhdvn pushed a commit to svmhdvn/freebsd-ports that referenced this issue Jan 10, 2024
libevhtp allocates a stack based on data length
when C99 is detected at compile time. There are
no checks to verify that the stack is big enough
which can cause a stack overflow.

Adding EVHTP_HAS_C99=false at compile time changes
this behavior by allocate to a buffer which has
proper checks in place.

More information about this bug can be found at:
Yellow-Camper/libevhtp#118
haiwen/seafile#1928

MFH:		2019Q3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants