sstate: inside the threadedpool don't write to the shared localdata

Message ID 20220306210823.53177-1-quaresma.jose@gmail.com
State Accepted, archived
Commit 1fa763b2022822a76fde541724e83e1977833d03
Headers show
Series sstate: inside the threadedpool don't write to the shared localdata | expand

Commit Message

Jose Quaresma March 6, 2022, 9:08 p.m. UTC
When inside the threadedpool we make a copy of the localdata
to avoid some race condition, so we need to use this new
localdata2 and stop write the shared localdata.

Signed-off-by: Jose Quaresma <quaresma.jose@gmail.com>
---
 meta/classes/sstate.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Richard Purdie March 6, 2022, 9:22 p.m. UTC | #1
On Sun, 2022-03-06 at 21:08 +0000, Jose Quaresma wrote:
> When inside the threadedpool we make a copy of the localdata
> to avoid some race condition, so we need to use this new
> localdata2 and stop write the shared localdata.
> 
> Signed-off-by: Jose Quaresma <quaresma.jose@gmail.com>
> ---
>  meta/classes/sstate.bbclass | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass
> index dc9a2c085b..7aca415159 100644
> --- a/meta/classes/sstate.bbclass
> +++ b/meta/classes/sstate.bbclass
> @@ -988,7 +988,7 @@ def sstate_checkhashes(sq_data, d, siginfo=False, currentcount=0, summary=True,
>  
>              localdata2 = bb.data.createCopy(localdata)
>              srcuri = "file://" + sstatefile
> -            localdata.setVar('SRC_URI', srcuri)
> +            localdata2.setVar('SRC_URI', srcuri)
>              bb.debug(2, "SState: Attempting to fetch %s" % srcuri)
>  
>              import traceback

That looks like a good find and may explain a few things!

Cheers,

Richard
Mark Hatle March 7, 2022, 4:14 p.m. UTC | #2
Note, it appears this bug is in honister as well.

On 3/6/22 3:08 PM, Jose Quaresma wrote:
> When inside the threadedpool we make a copy of the localdata
> to avoid some race condition, so we need to use this new
> localdata2 and stop write the shared localdata.
> 
> Signed-off-by: Jose Quaresma <quaresma.jose@gmail.com>
> ---
>   meta/classes/sstate.bbclass | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass
> index dc9a2c085b..7aca415159 100644
> --- a/meta/classes/sstate.bbclass
> +++ b/meta/classes/sstate.bbclass
> @@ -988,7 +988,7 @@ def sstate_checkhashes(sq_data, d, siginfo=False, currentcount=0, summary=True,
>   
>               localdata2 = bb.data.createCopy(localdata)
>               srcuri = "file://" + sstatefile
> -            localdata.setVar('SRC_URI', srcuri)
> +            localdata2.setVar('SRC_URI', srcuri)
>               bb.debug(2, "SState: Attempting to fetch %s" % srcuri)
>   
>               import traceback
> 
> 
> 
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#162790): https://lists.openembedded.org/g/openembedded-core/message/162790
> Mute This Topic: https://lists.openembedded.org/mt/89597961/3616948
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [mark.hatle@kernel.crashing.org]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Jose Quaresma March 7, 2022, 5:30 p.m. UTC | #3
Mark Hatle <mark.hatle@kernel.crashing.org> escreveu no dia segunda,
7/03/2022 à(s) 16:14:

> Note, it appears this bug is in honister as well.
>

is already a little old, dunfell needs this fix as well.

jose


>
> On 3/6/22 3:08 PM, Jose Quaresma wrote:
> > When inside the threadedpool we make a copy of the localdata
> > to avoid some race condition, so we need to use this new
> > localdata2 and stop write the shared localdata.
> >
> > Signed-off-by: Jose Quaresma <quaresma.jose@gmail.com>
> > ---
> >   meta/classes/sstate.bbclass | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass
> > index dc9a2c085b..7aca415159 100644
> > --- a/meta/classes/sstate.bbclass
> > +++ b/meta/classes/sstate.bbclass
> > @@ -988,7 +988,7 @@ def sstate_checkhashes(sq_data, d, siginfo=False,
> currentcount=0, summary=True,
> >
> >               localdata2 = bb.data.createCopy(localdata)
> >               srcuri = "file://" + sstatefile
> > -            localdata.setVar('SRC_URI', srcuri)
> > +            localdata2.setVar('SRC_URI', srcuri)
> >               bb.debug(2, "SState: Attempting to fetch %s" % srcuri)
> >
> >               import traceback
> >
> >
> >
> >
> >
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#162853):
> https://lists.openembedded.org/g/openembedded-core/message/162853
> Mute This Topic: https://lists.openembedded.org/mt/89597961/5052612
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [
> quaresma.jose@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>
Steve Sakoman March 7, 2022, 5:40 p.m. UTC | #4
On Mon, Mar 7, 2022 at 7:30 AM Jose Quaresma <quaresma.jose@gmail.com> wrote:
>
>
>
> Mark Hatle <mark.hatle@kernel.crashing.org> escreveu no dia segunda, 7/03/2022 à(s) 16:14:
>>
>> Note, it appears this bug is in honister as well.
>
>
> is already a little old, dunfell needs this fix as well.

In my test queue now.

Thanks!

Steve

>> On 3/6/22 3:08 PM, Jose Quaresma wrote:
>> > When inside the threadedpool we make a copy of the localdata
>> > to avoid some race condition, so we need to use this new
>> > localdata2 and stop write the shared localdata.
>> >
>> > Signed-off-by: Jose Quaresma <quaresma.jose@gmail.com>
>> > ---
>> >   meta/classes/sstate.bbclass | 2 +-
>> >   1 file changed, 1 insertion(+), 1 deletion(-)
>> >
>> > diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass
>> > index dc9a2c085b..7aca415159 100644
>> > --- a/meta/classes/sstate.bbclass
>> > +++ b/meta/classes/sstate.bbclass
>> > @@ -988,7 +988,7 @@ def sstate_checkhashes(sq_data, d, siginfo=False, currentcount=0, summary=True,
>> >
>> >               localdata2 = bb.data.createCopy(localdata)
>> >               srcuri = "file://" + sstatefile
>> > -            localdata.setVar('SRC_URI', srcuri)
>> > +            localdata2.setVar('SRC_URI', srcuri)
>> >               bb.debug(2, "SState: Attempting to fetch %s" % srcuri)
>> >
>> >               import traceback
>> >
>> >
>> >
>> >
>> >
>>
>>
>>
>
>
> --
> Best regards,
>
> José Quaresma
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#162856): https://lists.openembedded.org/g/openembedded-core/message/162856
> Mute This Topic: https://lists.openembedded.org/mt/89597961/3620601
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [steve@sakoman.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>

Patch

diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass
index dc9a2c085b..7aca415159 100644
--- a/meta/classes/sstate.bbclass
+++ b/meta/classes/sstate.bbclass
@@ -988,7 +988,7 @@  def sstate_checkhashes(sq_data, d, siginfo=False, currentcount=0, summary=True,
 
             localdata2 = bb.data.createCopy(localdata)
             srcuri = "file://" + sstatefile
-            localdata.setVar('SRC_URI', srcuri)
+            localdata2.setVar('SRC_URI', srcuri)
             bb.debug(2, "SState: Attempting to fetch %s" % srcuri)
 
             import traceback