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

Double calling of app_ch_dec_thread #18

Open
luochen01 opened this issue Aug 22, 2019 · 2 comments
Open

Double calling of app_ch_dec_thread #18

luochen01 opened this issue Aug 22, 2019 · 2 comments

Comments

@luochen01
Copy link

In the latest v2.6 version, I saw the channel counter is decremented twice in gl-prov. The first call is at [1] when gl-prov allocates the provision list. The second call is at [2] when the provision list is freed (after writes have been executed). This is clearly a bug and the channel counter should only be decremented once.

The question is when should the counter be decremented? Perhaps it should be decremented at [2] after writes have been executed.

[1]

app_ch_dec_thread(prov_ppa->ch[ch_id]);

[2]
app_ch_dec_thread(ppas->ch[i]);

@ivpi
Copy link
Member

ivpi commented Aug 26, 2019

Dear Chen,

Thank you for opening the issue. I have analyzed it this is what I found:

We have 2 arrays:
(i) prov_ppa->ch[ch_id] : Stores pointers to channels of provisioned PPAs. If a position is NULL, the related channel (with the same index) is not provisioned.
(ii) dec_ch[ch_id] : Stores pointers to channels that NOT provisioned. If a position is NULL, the related channel is provisioned.

Note: 'dec_ch' was defined because we need the pointer to the channels to be decreased at line 233.
Note: We start the function by increasing all active channels, and decrease the ones that were not provisioned at the end.

Suggestion: We may change the function to increase only provisioned channels. The increase function replaces the 'dec_ch' array at the line:

dec_ch[ch_id] = NULL;

Any comments?

@luochen01
Copy link
Author

Hi Ivan,

To summarize the analysis, the non-provisioned channels can be decremented twice, one after provisioning and one after writing is completed.

To address this problem, after we decrement the non-provisioned channels, shouldn't we unset the corresponding channel from prov_ppa->ch to NULL?

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

No branches or pull requests

2 participants