Skip to content

Commit

Permalink
ospfd: Do not turn on write thread unless we have something in it
Browse files Browse the repository at this point in the history
I am rarely seeing this crash:

r2: ospfd crashed. Core file found - Backtrace follows:
[New LWP 32748]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/aarch64-linux-gnu/libthread_db.so.1".
Core was generated by `/usr/lib/frr/ospfd'.
Program terminated with signal SIGABRT, Aborted.
2019-08-29 15:59:36,149 ERROR: assert failed at "test_ospf_sr_topo1/test_memory_leak":

Which translates to this code:

	node = listhead(ospf->oi_write_q);
	assert(node);
	oi = listgetdata(node);
	assert(oi);

So if we get into ospf_write without anything on the oi_write_q
we are stopping the program.

The only place that I see where we could possibly have this condition
was in OSPF_ISM_WRITE_ON(O).  Modify the macro to not just blindly
turn on ospf_write since we do not always add to the oi_write_q.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
  • Loading branch information
donaldsharp committed Aug 30, 2019
1 parent f4574b4 commit 275e0ed
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ospfd/ospf_ism.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@
listnode_add((O)->oi_write_q, oi); \
oi->on_write_q = 1; \
} \
thread_add_write(master, ospf_write, (O), (O)->fd, \
&(O)->t_write); \
if (!list_isempty((O)->oi_write_q)) \
thread_add_write(master, ospf_write, (O), (O)->fd, \
&(O)->t_write); \
} while (0)

/* Macro for OSPF ISM timer turn on. */
Expand Down

0 comments on commit 275e0ed

Please sign in to comment.