high concurrency api requests result in invalid responses

Description

When using the API with a high level of concurrency I get invalid responses in return:

Example:

debug: FREENAS HTTP REQUEST: {"method":"POST","url":" http://bitness.lan/api/v2.0/sharing/nfs ","headers":{"Accept":"application/json","User-Agent":"democratic-csi-driver","Content-Type":"application/json"},"json":true,"body":{"paths":["/mnt/pool0/k8s/on/v/pvc-b11383e3-dcda-4cba-a338-42d221ec4ed2"],"comment":"democratic-csi (org.democratic-csi.nfs): pool0/k8s/on/v/pvc-b11383e3-dcda-4cba-a338-42d221ec4ed2","networks":[],"hosts":[],"alldirs":false,"ro":false,"quiet":false,"maproot_user":"root","maproot_group":"wheel","mapall_user":"","mapall_group":"","security":[]},"agentOptions":{"rejectUnauthorized":false}}
debug: FREENAS HTTP ERROR: null
debug: FREENAS HTTP STATUS: 200
debug: FREENAS HTTP HEADERS: {"server":"nginx","date":"Mon, 30 Nov 2020 21:01:22 GMT","content-type":"text/plain; charset=utf-8","content-length":"433","connection":"close","strict-transport-security":"max-age=0","x-content-type-options":"nosniff","x-xss-protection":"1"}
debug: FREENAS HTTP BODY: {"id":29,"paths":["/mnt/pool0/k8s/on/v/pvc-b11383e3-dcda-4cba-a338-42d221ec4ed2"],"comment":"democratic-csi (org.democratic-csi.nfs): pool0/k8s/on/v/pvc-b11383e3-dcda-4cba-a338-42d221ec4ed2","hosts":[],"alldirs":false,"ro":false,"quiet":false,"maproot_user":"root","maproot_group":"wheel","mapall_user":"","mapall_group":"","security":[],"enabled":true,"networks":[],"locked":false}
verbose: ZfsProcessManager command: /usr/local/bin/sudo /usr/local/sbin/zfs set democratic-csi:freenas_nfs_share_id="29" pool0/k8s/on/v/pvc-b11383e3-dcda-4cba-a338-42d221ec4ed2
debug: FREENAS HTTP REQUEST: {"method":"POST","url":" http://bitness.lan/api/v2.0/sharing/nfs ","headers":{"Accept":"application/json","User-Agent":"democratic-csi-driver","Content-Type":"application/json"},"json":true,"body":{"paths":["/mnt/pool0/k8s/on/v/pvc-2d16db4d-47e4-484f-9791-29693f4c660f"],"comment":"democratic-csi (org.democratic-csi.nfs): pool0/k8s/on/v/pvc-2d16db4d-47e4-484f-9791-29693f4c660f","networks":[],"hosts":[],"alldirs":false,"ro":false,"quiet":false,"maproot_user":"root","maproot_group":"wheel","mapall_user":"","mapall_group":"","security":[]},"agentOptions":{"rejectUnauthorized":false}}
debug: FREENAS HTTP ERROR: null
debug: FREENAS HTTP STATUS: 200
debug: FREENAS HTTP HEADERS: {"server":"nginx","date":"Mon, 30 Nov 2020 21:01:22 GMT","content-type":"text/plain; charset=utf-8","content-length":"433","connection":"close","strict-transport-security":"max-age=0","x-content-type-options":"nosniff","x-xss-protection":"1"}
debug: FREENAS HTTP BODY: {"id":29,"paths":["/mnt/pool0/k8s/on/v/pvc-b11383e3-dcda-4cba-a338-42d221ec4ed2"],"comment":"democratic-csi (org.democratic-csi.nfs): pool0/k8s/on/v/pvc-b11383e3-dcda-4cba-a338-42d221ec4ed2","hosts":[],"alldirs":false,"ro":false,"quiet":false,"maproot_user":"root","maproot_group":"wheel","mapall_user":"","mapall_group":"","security":[],"enabled":true,"networks":[],"locked":false}
verbose: ZfsProcessManager command: /usr/local/bin/sudo /usr/local/sbin/zfs set democratic-csi:freenas_nfs_share_id="29" pool0/k8s/on/v/pvc-2d16db4d-47e4-484f-9791-29693f4c660f
verbose: ZfsProcessManager command: /usr/local/bin/sudo /usr/local/sbin/zfs set democratic-csi:csi_share_volume_context="{\"node_attach_driver\":\"nfs\",\"server\":\"bitness.lan\",\"share\":\"/mnt/pool0/k8s/on/v/pvc-b11383e3-dcda-4cba-a338-42d221ec4ed2\"}" pool0/k8s/on/v/pvc-b11383e3-dcda-4cba-a338-42d221ec4ed2
debug: FREENAS HTTP REQUEST: {"method":"POST","url":" http://bitness.lan/api/v2.0/sharing/nfs ","headers":{"Accept":"application/json","User-Agent":"democratic-csi-driver","Content-Type":"application/json"},"json":true,"body":{"paths":["/mnt/pool0/k8s/on/v/pvc-7723a5d4-66d6-4639-ab48-0124f0e5d9b0"],"comment":"democratic-csi (org.democratic-csi.nfs): pool0/k8s/on/v/pvc-7723a5d4-66d6-4639-ab48-0124f0e5d9b0","networks":[],"hosts":[],"alldirs":false,"ro":false,"quiet":false,"maproot_user":"root","maproot_group":"wheel","mapall_user":"","mapall_group":"","security":[]},"agentOptions":{"rejectUnauthorized":false}}
debug: FREENAS HTTP ERROR: null
debug: FREENAS HTTP STATUS: 200
debug: FREENAS HTTP HEADERS: {"server":"nginx","date":"Mon, 30 Nov 2020 21:01:23 GMT","content-type":"text/plain; charset=utf-8","content-length":"433","connection":"close","strict-transport-security":"max-age=0","x-content-type-options":"nosniff","x-xss-protection":"1"}
debug: FREENAS HTTP BODY: {"id":29,"paths":["/mnt/pool0/k8s/on/v/pvc-b11383e3-dcda-4cba-a338-42d221ec4ed2"],"comment":"democratic-csi (org.democratic-csi.nfs): pool0/k8s/on/v/pvc-b11383e3-dcda-4cba-a338-42d221ec4ed2","hosts":[],"alldirs":false,"ro":false,"quiet":false,"maproot_user":"root","maproot_group":"wheel","mapall_user":"","mapall_group":"","security":[],"enabled":true,"networks":[],"locked":false}
verbose: ZfsProcessManager command: /usr/local/bin/sudo /usr/local/sbin/zfs set democratic-csi:freenas_nfs_share_id="29" pool0/k8s/on/v/pvc-7723a5d4-66d6-4639-ab48-0124f0e5d9b0
debug: FREENAS HTTP REQUEST: {"method":"POST","url":" http://bitness.lan/api/v2.0/sharing/nfs ","headers":{"Accept":"application/json","User-Agent":"democratic-csi-driver","Content-Type":"application/json"},"json":true,"body":{"paths":["/mnt/pool0/k8s/on/v/pvc-cd51416a-e760-458a-8813-7d0812c73270"],"comment":"democratic-csi (org.democratic-csi.nfs): pool0/k8s/on/v/pvc-cd51416a-e760-458a-8813-7d0812c73270","networks":[],"hosts":[],"alldirs":false,"ro":false,"quiet":false,"maproot_user":"root","maproot_group":"wheel","mapall_user":"","mapall_group":"","security":[]},"agentOptions":{"rejectUnauthorized":false}}
debug: FREENAS HTTP ERROR: null
debug: FREENAS HTTP STATUS: 200
debug: FREENAS HTTP HEADERS: {"server":"nginx","date":"Mon, 30 Nov 2020 21:01:23 GMT","content-type":"text/plain; charset=utf-8","content-length":"433","connection":"close","strict-transport-security":"max-age=0","x-content-type-options":"nosniff","x-xss-protection":"1"}
debug: FREENAS HTTP BODY: {"id":29,"paths":["/mnt/pool0/k8s/on/v/pvc-b11383e3-dcda-4cba-a338-42d221ec4ed2"],"comment":"democratic-csi (org.democratic-csi.nfs): pool0/k8s/on/v/pvc-b11383e3-dcda-4cba-a338-42d221ec4ed2","hosts":[],"alldirs":false,"ro":false,"quiet":false,"maproot_user":"root","maproot_group":"wheel","mapall_user":"","mapall_group":"","security":[],"enabled":true,"networks":[],"locked":false}
verbose: ZfsProcessManager command: /usr/local/bin/sudo /usr/local/sbin/zfs set democratic-csi:freenas_nfs_share_id="29" pool0/k8s/on/v/pvc-cd51416a-e760-458a-8813-7d0812c73270
debug: FREENAS HTTP REQUEST: {"method":"POST","url":" http://bitness.lan/api/v2.0/sharing/nfs ","headers":{"Accept":"application/json","User-Agent":"democratic-csi-driver","Content-Type":"application/json"},"json":true,"body":{"paths":["/mnt/pool0/k8s/on/v/pvc-75b5d59a-c2f1-4938-b103-d7f86e212b9b"],"comment":"democratic-csi (org.democratic-csi.nfs): pool0/k8s/on/v/pvc-75b5d59a-c2f1-4938-b103-d7f86e212b9b","networks":[],"hosts":[],"alldirs":false,"ro":false,"quiet":false,"maproot_user":"root","maproot_group":"wheel","mapall_user":"","mapall_group":"","security":[]},"agentOptions":{"rejectUnauthorized":false}}
debug: FREENAS HTTP ERROR: null
debug: FREENAS HTTP STATUS: 200
debug: FREENAS HTTP HEADERS: {"server":"nginx","date":"Mon, 30 Nov 2020 21:01:23 GMT","content-type":"text/plain; charset=utf-8","content-length":"433","connection":"close","strict-transport-security":"max-age=0","x-content-type-options":"nosniff","x-xss-protection":"1"}
debug: FREENAS HTTP BODY: {"id":29,"paths":["/mnt/pool0/k8s/on/v/pvc-b11383e3-dcda-4cba-a338-42d221ec4ed2"],"comment":"democratic-csi (org.democratic-csi.nfs): pool0/k8s/on/v/pvc-b11383e3-dcda-4cba-a338-42d221ec4ed2","hosts":[],"alldirs":false,"ro":false,"quiet":false,"maproot_user":"root","maproot_group":"wheel","mapall_user":"","mapall_group":"","security":[],"enabled":true,"networks":[],"locked":false}

Notice there are several POSTs each with different data but the ID of 29 is returned for all of them. My guess is the endpoints are doing something like SELECT * FROM MAX(id) instead of using the the sqlite last_insert_rowid()

I believe I've seen the same behavior for smb shares and the various iscsi assets as well.

Note that new records are being created, the client is just receiving the wrong response.

Problem/Justification

None

Impact

None

SmartDraw Connector

Katalon Manual Tests (BETA)

Activity

Show:

Bug Clerk December 9, 2020 at 4:53 PM

William Gryzbowski December 8, 2020 at 2:34 PM

12.0 PR will be merged after freeze is lifted.

Bug Clerk December 4, 2020 at 2:13 PM

Complete
Pinned fields
Click on the next to a field label to start pinning.

Details

Assignee

Reporter

Components

Priority

More fields

Katalon Platform

Created December 3, 2020 at 11:19 PM
Updated July 1, 2022 at 4:59 PM
Resolved December 8, 2020 at 2:34 PM