[ovs-dev] [PATCH v3 9/9] ovsdb-idl: Break into two layers.
Ben Pfaff
blp at ovn.org
Sat Dec 19 02:41:16 UTC 2020
On Fri, Dec 18, 2020 at 10:31:19AM +0100, Dumitru Ceara wrote:
> On 12/18/20 6:31 AM, Ben Pfaff wrote:
> > This change breaks the IDL into two layers: the IDL proper, whose
> > interface to its client is unchanged, and a low-level library called
> > the OVSDB "client synchronization" (CS) library. There are two
> > reasons for this change. First, the IDL is big and complicated and
> > I think that this change factors out some of that complication into
> > a simpler lower layer. Second, the OVN northd implementation based
> > on DDlog can benefit from the client synchronization library even
> > though it would actually be made increasingly complicated by the IDL.
> >
> > Signed-off-by: Ben Pfaff <blp at ovn.org>
> > ---
>
> Hi Ben,
>
> When running OVN tests with this OVS series applied, AddressSanitizer
> reports a couple of leaks.
>
> One is straightforward to fix, please see inline.
Thanks, I fixed that one.
> The other one I couldn't figure out:
>
> ==1273641==ERROR: LeakSanitizer: detected memory leaks
>
> Direct leak of 40 byte(s) in 1 object(s) allocated from:
> #0 0x7f65764f1667 in __interceptor_malloc (/lib64/libasan.so.6+0xb0667)
> #1 0x5b623f in xmalloc lib/util.c:138
> #2 0x6074ad in json_create lib/json.c:1451
> #3 0x601dee in json_integer_create lib/json.c:263
> #4 0x60ae64 in jsonrpc_create_id lib/jsonrpc.c:563
> #5 0x60ae7f in jsonrpc_create_request lib/jsonrpc.c:570
> #6 0x66fbd6 in ovsdb_cs_send_transaction lib/ovsdb-cs.c:1357
> #7 0x575c6b in ovsdb_idl_txn_commit lib/ovsdb-idl.c:3147
> #8 0x575f1e in ovsdb_idl_txn_commit_block lib/ovsdb-idl.c:3186
> #9 0x4103d4 in do_sbctl utilities/ovn-sbctl.c:1688
> #10 0x407e39 in main utilities/ovn-sbctl.c:152
> #11 0x7f6575c53041 in __libc_start_main (/lib64/libc.so.6+0x27041
I fixed this one too. There was an unneeded json_clone().
I folded in the following incremental for v4:
diff --git a/lib/ovsdb-cs.c b/lib/ovsdb-cs.c
index 386d37b413f7..285b164108b2 100644
--- a/lib/ovsdb-cs.c
+++ b/lib/ovsdb-cs.c
@@ -292,7 +292,7 @@ ovsdb_cs_db_init(struct ovsdb_cs_db *db, const char *db_name,
{
*db = (struct ovsdb_cs_db) {
.cs = parent,
- .db_name = xstrdup(db_name),
+ .db_name = db_name,
.tables = HMAP_INITIALIZER(&db->tables),
.max_version = max_version,
.monitor_id = json_array_create_2(json_string_create("monid"),
@@ -1366,7 +1366,7 @@ ovsdb_cs_send_transaction(struct ovsdb_cs *cs, struct json *operations)
cs->txns = x2nrealloc(cs->txns, &cs->allocated_txns,
sizeof *cs->txns);
}
- cs->txns[cs->n_txns++] = json_clone(request_id);
+ cs->txns[cs->n_txns++] = request_id;
return request_id;
}
More information about the dev
mailing list