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

libflux/buffer: Add trimmed peek/read line variants #1639

Merged
merged 1 commit into from
Aug 31, 2018

Conversation

chu11
Copy link
Member

@chu11 chu11 commented Aug 31, 2018

For convenience, support flux_buffer_peek_trimmed_line() and
flux_buffer_read_trimmed_line() variants, which will read lines
but strip off any trailing newline characters.

Fixes #1624

For convenience, support flux_buffer_peek_trimmed_line() and
flux_buffer_read_trimmed_line() variants, which will read lines
but strip off any trailing newline characters.

Fixes flux-framework#1624
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.002%) to 79.146% when pulling ff4a7a7 on chu11:issue1624 into 29c0c6c on flux-framework:master.

@chu11
Copy link
Member Author

chu11 commented Aug 31, 2018

Hit a valgrind fail, which I'm fairly certain this PR has nothing to do with. I also hit a similar one in #1564. I'm going to open an issue on it. Restarted the builder though.

�[31mFound ./t/t5000-valgrind.output�[39m
expecting success: 
	libtool e flux ${VALGRIND} \
		--tool=memcheck \
		--leak-check=full \
		--gen-suppressions=all \
		--trace-children=no \
		--child-silent-after-fork=yes \
		--num-callers=30 \
		--leak-resolution=med \
		--error-exitcode=1 \
		--suppressions=$VALGRIND_SUPPRESSIONS \
		${BROKER} --shutdown-grace=4 ${VALGRIND_WORKLOAD} 10

==12893== Memcheck, a memory error detector
==12893== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==12893== Using Valgrind-3.10.1 and LibVEX; rerun with -h for copyright info
==12893== Command: /home/travis/build/flux-framework/flux-core/src/broker/.libs/lt-flux-broker --shutdown-grace=4 /home/travis/build/flux-framework/flux-core/t/valgrind/valgrind-workload.sh 10
==12893== 
FLUX_URI=local:///tmp/flux-MivVCS
2018-08-31T19:35:47.995037Z connector-local.err[0]: send kvs.watch response to client 442F0: Broken pipe
==12893== 
==12893== HEAP SUMMARY:
==12893==     in use at exit: 130,944 bytes in 155 blocks
==12893==   total heap usage: 940,255 allocs, 940,100 frees, 79,491,791 bytes allocated
==12893== 
==12893== 8,620 (64 direct, 8,556 indirect) bytes in 1 blocks are definitely lost in loss record 71 of 74
==12893==    at 0x4C2CC70: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==12893==    by 0x4E5D92C: then_context_create (future.c:165)
==12893==    by 0x4E5D92C: flux_future_then (future.c:537)
==12893==    by 0x8D026E7: spawn_exec_handler (job.c:712)
==12893==    by 0x8D026E7: runevent_continuation (job.c:762)
==12893==    by 0x4E7B2F4: ev_invoke_pending (ev.c:3314)
==12893==    by 0x4E7E4B6: ev_run (ev.c:3717)
==12893==    by 0x4E523A2: flux_reactor_run (reactor.c:132)
==12893==    by 0x8D02B66: mod_main (job.c:943)
==12893==    by 0x40A978: module_thread (module.c:158)
==12893==    by 0x59D6183: start_thread (pthread_create.c:312)
==12893==    by 0x5EEE03C: clone (clone.S:111)
==12893== 
{
   <insert_a_suppression_name_here>
   Memcheck:Leak
   match-leak-kinds: definite
   fun:calloc
   fun:then_context_create
   fun:flux_future_then
   fun:spawn_exec_handler
   fun:runevent_continuation
   fun:ev_invoke_pending
   fun:ev_run
   fun:flux_reactor_run
   fun:mod_main
   fun:module_thread
   fun:start_thread
   fun:clone
}
==12893== 10,964 bytes in 1 blocks are definitely lost in loss record 72 of 74
==12893==    at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==12893==    by 0x5583A10: zmq::msg_t::init_size(unsigned long) (msg.cpp:77)
==12893==    by 0x52DA75C: zframe_new (zframe.c:52)
==12893==    by 0x52E4A85: zmsg_addmem (zmsg.c:293)
==12893==    by 0x4E57D21: flux_msg_copy (message.c:1324)
==12893==    by 0x8D01846: job_create_cb (job.c:423)
==12893==    by 0x4E53193: call_handler (msg_handler.c:302)
==12893==    by 0x4E5330E: dispatch_message (msg_handler.c:326)
==12893==    by 0x4E5330E: handle_cb (msg_handler.c:392)
==12893==    by 0x4E7B2F4: ev_invoke_pending (ev.c:3314)
==12893==    by 0x4E7E4B6: ev_run (ev.c:3717)
==12893==    by 0x4E523A2: flux_reactor_run (reactor.c:132)
==12893==    by 0x8D02B66: mod_main (job.c:943)
==12893==    by 0x40A978: module_thread (module.c:158)
==12893==    by 0x59D6183: start_thread (pthread_create.c:312)
==12893==    by 0x5EEE03C: clone (clone.S:111)
==12893== 
{
   <insert_a_suppression_name_here>
   Memcheck:Leak
   match-leak-kinds: definite
   fun:malloc
   fun:_ZN3zmq5msg_t9init_sizeEm
   fun:zframe_new
   fun:zmsg_addmem
   fun:flux_msg_copy
   fun:job_create_cb
   fun:call_handler
   fun:dispatch_message
   fun:handle_cb
   fun:ev_invoke_pending
   fun:ev_run
   fun:flux_reactor_run
   fun:mod_main
   fun:module_thread
   fun:start_thread
   fun:clone
}
==12893== LEAK SUMMARY:
==12893==    definitely lost: 11,028 bytes in 2 blocks
==12893==    indirectly lost: 8,548 bytes in 43 blocks
==12893==      possibly lost: 0 bytes in 0 blocks
==12893==    still reachable: 110,848 bytes in 108 blocks
==12893==         suppressed: 520 bytes in 2 blocks
==12893== Reachable blocks (those to which a pointer was found) are not shown.
==12893== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==12893== 
==12893== For counts of detected and suppressed errors, rerun with: -v
==12893== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 1 from 1)
not ok 1 - valgrind reports no new errors on single broker run

# failed 1 among 1 test(s)
1..1

@grondo
Copy link
Contributor

grondo commented Aug 31, 2018

Seems good to me. At first I was thinking we should add a string of characters to trim, instead of just trimming one possible newline (e.g. any whitespace character might be useful), but that could be added later if even necessary.

LGTM!

@grondo grondo merged commit 6eb1154 into flux-framework:master Aug 31, 2018
@chu11 chu11 deleted the issue1624 branch June 5, 2021 18:00
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.

3 participants