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

core: flb_scheduler fix for macOS #2463

Merged
merged 1 commit into from
Aug 14, 2020

Conversation

bluebike
Copy link
Contributor

@bluebike bluebike commented Aug 12, 2020

ret = flb_pipe_r(fd, &val, sizeof(val));
if (ret <= 0) {
flb_errno();
return -1;
}

src/flb_scheduler.c: cosumer_bytes() gives errors in macOS (10.13,... ?).
function flb_pipe_r can return value 0 which is consider as error.
This patch allows return value zero.

Probably we should test if ret == 0 is ok in other operating systems.

Fixes #2460

Enter [N/A] in the box, if an item is not applicable to your change.

Testing
Before we can approve your change; please submit the following in a comment:

  • [N/A] Example configuration file for the change
  • Debug log output from testing the change
  • [N/A] Attached Valgrind output that shows no leaks or memory corruption was found

Documentation

  • [N/A] Documentation required for this feature

Fluent Bit is licensed under Apache 2.0, by submitting this pull request I understand that this code will be released under the terms of that license.

src/flb_scheduler.c: cosumer_bytes() gives errors in macOS (10.13,... ?).
function flb_pipe_r can return value 0 if is considered as error.
This patch allows return value zero.

Signed-off-by: Jukka Pihl <jukka.pihl@iki.fi>
@bluebike
Copy link
Contributor Author

Test run after patch

$ bin/fluent-bit -i dummy -o stdout
Fluent Bit v1.6.0
* Copyright (C) 2019-2020 The Fluent Bit Authors
* Copyright (C) 2015-2018 Treasure Data
* Fluent Bit is a CNCF sub-project under the umbrella of Fluentd
* https://fluentbit.io

[2020/08/12 11:48:37] [ info] [engine] started (pid=67982)
[2020/08/12 11:48:37] [ info] [storage] version=1.0.5, initializing...
[2020/08/12 11:48:37] [ info] [storage] in-memory
[2020/08/12 11:48:37] [ info] [storage] normal synchronization mode, checksum disabled, max_chunks_up=128
[2020/08/12 11:48:37] [ info] [sp] stream processor started
[0] dummy.0: [1597222118.028957000, {"message"=>"dummy"}]
[1] dummy.0: [1597222119.027146000, {"message"=>"dummy"}]
[2] dummy.0: [1597222120.028602000, {"message"=>"dummy"}]
[3] dummy.0: [1597222121.027044000, {"message"=>"dummy"}]
[0] dummy.0: [1597222122.028639000, {"message"=>"dummy"}]
[1] dummy.0: [1597222123.026792000, {"message"=>"dummy"}]
[2] dummy.0: [1597222124.028137000, {"message"=>"dummy"}]

@edsiper edsiper merged commit e8f1d81 into fluent:master Aug 14, 2020
@edsiper
Copy link
Member

edsiper commented Aug 14, 2020

thanks

edsiper pushed a commit that referenced this pull request Aug 14, 2020
src/flb_scheduler.c: cosumer_bytes() gives errors in macOS (10.13,... ?).
function flb_pipe_r can return value 0 if is considered as error.
This patch allows return value zero.

Signed-off-by: Jukka Pihl <jukka.pihl@iki.fi>
girgen added a commit to girgen/fluent-bit that referenced this pull request Nov 17, 2020
This is partly related to fluent#2463 for MacOS.

The first one is in  flb_pipe_r() function returning 0 on FreeBSD 12+ and that
brings up errors similar to "[error] [src/flb_scheduler.c:52 errno=0] No error:
0". This patch will fix it the same way as it was fixed by upstream code for
MacOS.

The second issue is a SIGSEGV that is caused by incorrect section
structure of the resulting binary file generated by clang due to some gcc
specific code in libco.  Since there are two copies of libco (flb_libco) code
in the fluent-bit sources - one in the lib/flb_libco folder and another one in
lib/monkey/deps/flb_libco - they are both patched the same way.

This patches were tested on FreeBSD 11.4 and 12.2 amd64.
The resulting binaries was tested with "elfdump -a" to contain only one ".text"
section and their startup logs were tested running "fluent-bit -v -i dummy -o
stdout".

Submitted by: Yuri Pankov and Artyom Davidov
Signed-off-by: Palle Girgensohn <girgen@FreeBSD.org>
girgen pushed a commit to girgen/fluent-bit that referenced this pull request Nov 19, 2020
This is partly related to fluent#2463 for MacOS.

The first one is in  flb_pipe_r() function returning 0 on FreeBSD 12+ and that
brings up errors similar to "[error] [src/flb_scheduler.c:52 errno=0] No error:
0". This patch will fix it the same way as it was fixed by upstream code for
MacOS.

The second issue is a SIGSEGV that is caused by incorrect section
structure of the resulting binary file generated by clang due to some gcc
specific code in libco.  Since there are two copies of libco (flb_libco) code
in the fluent-bit sources - one in the lib/flb_libco folder and another one in
lib/monkey/deps/flb_libco - they are both patched the same way.

This patches were tested on FreeBSD 11.4 and 12.2 amd64.
The resulting binaries was tested with "elfdump -a" to contain only one ".text"
section and their startup logs were tested running "fluent-bit -v -i dummy -o
stdout".

Submitted by: Yuri Pankov and Artyom Davidov
Signed-off-by: Palle Girgensohn <girgen@FreeBSD.org>
girgen pushed a commit to girgen/fluent-bit that referenced this pull request Nov 19, 2020
This is related to fluent#2463 for MacOS.

In flb_pipe_r() function is returning 0 on FreeBSD 12+ and that brings up
errors similar to "[error] [src/flb_scheduler.c:52 errno=0] No error: 0". This
patch will fix it the same way as it was previously fixed for MacOS.

This patch was tested on FreeBSD 11.4 and 12.2 amd64.  The resulting binaries
was tested with "elfdump -a" to contain only one ".text" section and their
startup logs were tested running "fluent-bit -v -i dummy -o stdout".

See also: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=250825
Submitted by: Yuri Pankov and Artyom Davidov
Signed-off-by: Palle Girgensohn <girgen@FreeBSD.org>
edsiper pushed a commit that referenced this pull request Nov 20, 2020
This is related to #2463 for MacOS.

In flb_pipe_r() function is returning 0 on FreeBSD 12+ and that brings up
errors similar to "[error] [src/flb_scheduler.c:52 errno=0] No error: 0". This
patch will fix it the same way as it was previously fixed for MacOS.

This patch was tested on FreeBSD 11.4 and 12.2 amd64.  The resulting binaries
was tested with "elfdump -a" to contain only one ".text" section and their
startup logs were tested running "fluent-bit -v -i dummy -o stdout".

See also: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=250825
Submitted by: Yuri Pankov and Artyom Davidov
Signed-off-by: Palle Girgensohn <girgen@FreeBSD.org>

Co-authored-by: Palle Girgensohn <girgen@FreeBSD.org>
edsiper pushed a commit that referenced this pull request Nov 20, 2020
This is related to #2463 for MacOS.

In flb_pipe_r() function is returning 0 on FreeBSD 12+ and that brings up
errors similar to "[error] [src/flb_scheduler.c:52 errno=0] No error: 0". This
patch will fix it the same way as it was previously fixed for MacOS.

This patch was tested on FreeBSD 11.4 and 12.2 amd64.  The resulting binaries
was tested with "elfdump -a" to contain only one ".text" section and their
startup logs were tested running "fluent-bit -v -i dummy -o stdout".

See also: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=250825
Submitted by: Yuri Pankov and Artyom Davidov
Signed-off-by: Palle Girgensohn <girgen@FreeBSD.org>

Co-authored-by: Palle Girgensohn <girgen@FreeBSD.org>
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

Successfully merging this pull request may close these issues.

Undefined error in flb_scheduler.c on macOS
2 participants