Commit Graph

8 Commits

Author SHA1 Message Date
Quentin Young
ecf9fb30b7 lib: convert GRPC plugin to async
Synchronous GRPC services are called from arbitrary threads. This makes
access to anything outside the GRPC module unsafe. We need to convert
the plugin to use the async model that allows us to control our own
threads.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2020-05-08 15:50:11 -04:00
Chirag Shah
0edcb505a3 lib: use frr_pthread to spawn grpc pthread
start grpc thread with frr_pthread library
callbacks to integrate with rcu infrastructure.

If a thread is created using native pthread callbacks
and if zlog is used then it leads to crash.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2020-05-08 15:50:11 -04:00
Renato Westphal
97cd849362 lib: create a wrapper function for all northbound callbacks
The intention here is to keep the code more organized. These wrappers
should be used by the northbound clients only, and never directly
by any YANG backend code.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2020-04-23 01:21:46 -03:00
Quentin Young
20b0a2ed3e lib: defer grpc plugin initialization to post fork
When using the GRPC northbound plugin, initialization occurs at the
frr_late_init hook. This is called before fork() when daemonizing (using
-d). Because the GRPC library internally creates threads, this means our
threads go away in the child process, so GRPC doesn't work when used
with -d. Rectify this situation by deferring plugin init to after fork
by scheduling a task on the threadmaster, since those are executed by
the child.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2020-03-30 14:28:10 -04:00
Renato Westphal
07705c8b8a lib: silence compiler warning in the gRPC plugin
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2019-10-16 17:13:28 -03:00
Quentin Young
63d12a7d77 lib: fix gRPC northbound plugin build
Some issues with our internal vector type being typedef'd as `vector`,
which conflicts with the C++ standard vector class...

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-10-08 19:13:50 +00:00
Renato Westphal
8685be73e0 Revert "lib: introduce a read-write lock for northbound configurations"
Adding a lock to protect the global running configuration doesn't
help much since the FRR daemons are not prepared to process
configuration changes in a pthread that is not the main one (a
whole lot of new protections would be necessary to prevent race
conditions).

This means the lock added by commit 83981138 only adds more
complexity for no benefit. Remove it now to simplify the code.

All northbound clients, including the gRPC one, should either run
in the main pthread or use synchronization primitives to process
configuration transactions in the main pthread.

This reverts commit 83981138fe.
2019-09-18 14:35:10 -03:00
Renato Westphal
ec2ac5f28a lib: add new gRPC-based northbound plugin
This is an experimental plugin for now. Full documentation will
come later.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2019-04-26 18:15:32 -03:00