* [bitbake][dunfell][1.46][PATCH v2] hashserv: specify loop for asyncio in python < 3.6
@ 2022-01-21 14:51 Jate Sujjavanich
2022-01-21 14:55 ` Steve Sakoman
0 siblings, 1 reply; 4+ messages in thread
From: Jate Sujjavanich @ 2022-01-21 14:51 UTC (permalink / raw)
To: bitbake-devel, steve; +Cc: Jate Sujjavanich
[YOCTO #14697]
Detect python version 3.5 restoring loop argument where
it is still required. In 3.6 auto loop detection is available.
Bitbake 1.46 is used in dunfell which lists a minimum python version
of 3.5. Omitting this argument leads to a regression and hang during
"Initialising tasks" at 44%.
Signed-off-by: Jate Sujjavanich <jatedev@gmail.com>
---
lib/hashserv/server.py | 23 +++++++++++++++++------
1 file changed, 17 insertions(+), 6 deletions(-)
diff --git a/lib/hashserv/server.py b/lib/hashserv/server.py
index 56f354bd..f38a22ad 100644
--- a/lib/hashserv/server.py
+++ b/lib/hashserv/server.py
@@ -12,6 +12,7 @@ import math
import os
import signal
import socket
+import sys
import time
from . import chunkify, DEFAULT_MAX_CHUNK
@@ -419,9 +420,14 @@ class Server(object):
self._cleanup_socket = None
def start_tcp_server(self, host, port):
- self.server = self.loop.run_until_complete(
- asyncio.start_server(self.handle_client, host, port)
- )
+ if sys.version_info[0] == 3 and sys.version_info[1] < 6:
+ self.server = self.loop.run_until_complete(
+ asyncio.start_server(self.handle_client, host, port, loop=self.loop)
+ )
+ else:
+ self.server = self.loop.run_until_complete(
+ asyncio.start_server(self.handle_client, host, port)
+ )
for s in self.server.sockets:
logger.info('Listening on %r' % (s.getsockname(),))
@@ -444,9 +450,14 @@ class Server(object):
try:
# Work around path length limits in AF_UNIX
os.chdir(os.path.dirname(path))
- self.server = self.loop.run_until_complete(
- asyncio.start_unix_server(self.handle_client, os.path.basename(path))
- )
+ if sys.version_info[0] == 3 and sys.version_info[1] < 6:
+ self.server = self.loop.run_until_complete(
+ asyncio.start_unix_server(self.handle_client, os.path.basename(path), loop=self.loop)
+ )
+ else:
+ self.server = self.loop.run_until_complete(
+ asyncio.start_unix_server(self.handle_client, os.path.basename(path))
+ )
finally:
os.chdir(cwd)
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [bitbake][dunfell][1.46][PATCH v2] hashserv: specify loop for asyncio in python < 3.6
2022-01-21 14:51 [bitbake][dunfell][1.46][PATCH v2] hashserv: specify loop for asyncio in python < 3.6 Jate Sujjavanich
@ 2022-01-21 14:55 ` Steve Sakoman
2022-01-21 16:05 ` Jate Sujjavanich
0 siblings, 1 reply; 4+ messages in thread
From: Steve Sakoman @ 2022-01-21 14:55 UTC (permalink / raw)
To: Jate Sujjavanich; +Cc: bitbake-devel
Hi Jate,
Just want to confirm that the only difference between V1 and V2 is the
addition of the reference to the bug number?
Thanks,
Steve
On Fri, Jan 21, 2022 at 4:52 AM Jate Sujjavanich <jatedev@gmail.com> wrote:
>
> [YOCTO #14697]
>
> Detect python version 3.5 restoring loop argument where
> it is still required. In 3.6 auto loop detection is available.
>
> Bitbake 1.46 is used in dunfell which lists a minimum python version
> of 3.5. Omitting this argument leads to a regression and hang during
> "Initialising tasks" at 44%.
>
> Signed-off-by: Jate Sujjavanich <jatedev@gmail.com>
> ---
> lib/hashserv/server.py | 23 +++++++++++++++++------
> 1 file changed, 17 insertions(+), 6 deletions(-)
>
> diff --git a/lib/hashserv/server.py b/lib/hashserv/server.py
> index 56f354bd..f38a22ad 100644
> --- a/lib/hashserv/server.py
> +++ b/lib/hashserv/server.py
> @@ -12,6 +12,7 @@ import math
> import os
> import signal
> import socket
> +import sys
> import time
> from . import chunkify, DEFAULT_MAX_CHUNK
>
> @@ -419,9 +420,14 @@ class Server(object):
> self._cleanup_socket = None
>
> def start_tcp_server(self, host, port):
> - self.server = self.loop.run_until_complete(
> - asyncio.start_server(self.handle_client, host, port)
> - )
> + if sys.version_info[0] == 3 and sys.version_info[1] < 6:
> + self.server = self.loop.run_until_complete(
> + asyncio.start_server(self.handle_client, host, port, loop=self.loop)
> + )
> + else:
> + self.server = self.loop.run_until_complete(
> + asyncio.start_server(self.handle_client, host, port)
> + )
>
> for s in self.server.sockets:
> logger.info('Listening on %r' % (s.getsockname(),))
> @@ -444,9 +450,14 @@ class Server(object):
> try:
> # Work around path length limits in AF_UNIX
> os.chdir(os.path.dirname(path))
> - self.server = self.loop.run_until_complete(
> - asyncio.start_unix_server(self.handle_client, os.path.basename(path))
> - )
> + if sys.version_info[0] == 3 and sys.version_info[1] < 6:
> + self.server = self.loop.run_until_complete(
> + asyncio.start_unix_server(self.handle_client, os.path.basename(path), loop=self.loop)
> + )
> + else:
> + self.server = self.loop.run_until_complete(
> + asyncio.start_unix_server(self.handle_client, os.path.basename(path))
> + )
> finally:
> os.chdir(cwd)
>
> --
> 2.25.1
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [bitbake][dunfell][1.46][PATCH v2] hashserv: specify loop for asyncio in python < 3.6
2022-01-21 14:55 ` Steve Sakoman
@ 2022-01-21 16:05 ` Jate Sujjavanich
2022-01-21 16:31 ` Steve Sakoman
0 siblings, 1 reply; 4+ messages in thread
From: Jate Sujjavanich @ 2022-01-21 16:05 UTC (permalink / raw)
To: Steve Sakoman; +Cc: bitbake-devel
[-- Attachment #1: Type: text/plain, Size: 3052 bytes --]
- Changed the version check on the minor (< 7 to <6) after testing python
3.6 with bitbake.
- Changed the comment to reflect this
- Added Bugzilla tracker
On Fri, Jan 21, 2022 at 9:55 AM Steve Sakoman <steve@sakoman.com> wrote:
> Hi Jate,
>
> Just want to confirm that the only difference between V1 and V2 is the
> addition of the reference to the bug number?
>
> Thanks,
>
> Steve
>
> On Fri, Jan 21, 2022 at 4:52 AM Jate Sujjavanich <jatedev@gmail.com>
> wrote:
> >
> > [YOCTO #14697]
> >
> > Detect python version 3.5 restoring loop argument where
> > it is still required. In 3.6 auto loop detection is available.
> >
> > Bitbake 1.46 is used in dunfell which lists a minimum python version
> > of 3.5. Omitting this argument leads to a regression and hang during
> > "Initialising tasks" at 44%.
> >
> > Signed-off-by: Jate Sujjavanich <jatedev@gmail.com>
> > ---
> > lib/hashserv/server.py | 23 +++++++++++++++++------
> > 1 file changed, 17 insertions(+), 6 deletions(-)
> >
> > diff --git a/lib/hashserv/server.py b/lib/hashserv/server.py
> > index 56f354bd..f38a22ad 100644
> > --- a/lib/hashserv/server.py
> > +++ b/lib/hashserv/server.py
> > @@ -12,6 +12,7 @@ import math
> > import os
> > import signal
> > import socket
> > +import sys
> > import time
> > from . import chunkify, DEFAULT_MAX_CHUNK
> >
> > @@ -419,9 +420,14 @@ class Server(object):
> > self._cleanup_socket = None
> >
> > def start_tcp_server(self, host, port):
> > - self.server = self.loop.run_until_complete(
> > - asyncio.start_server(self.handle_client, host, port)
> > - )
> > + if sys.version_info[0] == 3 and sys.version_info[1] < 6:
> > + self.server = self.loop.run_until_complete(
> > + asyncio.start_server(self.handle_client, host, port,
> loop=self.loop)
> > + )
> > + else:
> > + self.server = self.loop.run_until_complete(
> > + asyncio.start_server(self.handle_client, host, port)
> > + )
> >
> > for s in self.server.sockets:
> > logger.info('Listening on %r' % (s.getsockname(),))
> > @@ -444,9 +450,14 @@ class Server(object):
> > try:
> > # Work around path length limits in AF_UNIX
> > os.chdir(os.path.dirname(path))
> > - self.server = self.loop.run_until_complete(
> > - asyncio.start_unix_server(self.handle_client,
> os.path.basename(path))
> > - )
> > + if sys.version_info[0] == 3 and sys.version_info[1] < 6:
> > + self.server = self.loop.run_until_complete(
> > + asyncio.start_unix_server(self.handle_client,
> os.path.basename(path), loop=self.loop)
> > + )
> > + else:
> > + self.server = self.loop.run_until_complete(
> > + asyncio.start_unix_server(self.handle_client,
> os.path.basename(path))
> > + )
> > finally:
> > os.chdir(cwd)
> >
> > --
> > 2.25.1
> >
>
[-- Attachment #2: Type: text/html, Size: 4222 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [bitbake][dunfell][1.46][PATCH v2] hashserv: specify loop for asyncio in python < 3.6
2022-01-21 16:05 ` Jate Sujjavanich
@ 2022-01-21 16:31 ` Steve Sakoman
0 siblings, 0 replies; 4+ messages in thread
From: Steve Sakoman @ 2022-01-21 16:31 UTC (permalink / raw)
To: Jate Sujjavanich; +Cc: bitbake-devel
On Fri, Jan 21, 2022 at 6:05 AM Jate Sujjavanich <jatedev@gmail.com> wrote:
>
> - Changed the version check on the minor (< 7 to <6) after testing python 3.6 with bitbake.
> - Changed the comment to reflect this
> - Added Bugzilla tracker
Thanks!
Steve
> On Fri, Jan 21, 2022 at 9:55 AM Steve Sakoman <steve@sakoman.com> wrote:
>>
>> Hi Jate,
>>
>> Just want to confirm that the only difference between V1 and V2 is the
>> addition of the reference to the bug number?
>>
>> Thanks,
>>
>> Steve
>>
>> On Fri, Jan 21, 2022 at 4:52 AM Jate Sujjavanich <jatedev@gmail.com> wrote:
>> >
>> > [YOCTO #14697]
>> >
>> > Detect python version 3.5 restoring loop argument where
>> > it is still required. In 3.6 auto loop detection is available.
>> >
>> > Bitbake 1.46 is used in dunfell which lists a minimum python version
>> > of 3.5. Omitting this argument leads to a regression and hang during
>> > "Initialising tasks" at 44%.
>> >
>> > Signed-off-by: Jate Sujjavanich <jatedev@gmail.com>
>> > ---
>> > lib/hashserv/server.py | 23 +++++++++++++++++------
>> > 1 file changed, 17 insertions(+), 6 deletions(-)
>> >
>> > diff --git a/lib/hashserv/server.py b/lib/hashserv/server.py
>> > index 56f354bd..f38a22ad 100644
>> > --- a/lib/hashserv/server.py
>> > +++ b/lib/hashserv/server.py
>> > @@ -12,6 +12,7 @@ import math
>> > import os
>> > import signal
>> > import socket
>> > +import sys
>> > import time
>> > from . import chunkify, DEFAULT_MAX_CHUNK
>> >
>> > @@ -419,9 +420,14 @@ class Server(object):
>> > self._cleanup_socket = None
>> >
>> > def start_tcp_server(self, host, port):
>> > - self.server = self.loop.run_until_complete(
>> > - asyncio.start_server(self.handle_client, host, port)
>> > - )
>> > + if sys.version_info[0] == 3 and sys.version_info[1] < 6:
>> > + self.server = self.loop.run_until_complete(
>> > + asyncio.start_server(self.handle_client, host, port, loop=self.loop)
>> > + )
>> > + else:
>> > + self.server = self.loop.run_until_complete(
>> > + asyncio.start_server(self.handle_client, host, port)
>> > + )
>> >
>> > for s in self.server.sockets:
>> > logger.info('Listening on %r' % (s.getsockname(),))
>> > @@ -444,9 +450,14 @@ class Server(object):
>> > try:
>> > # Work around path length limits in AF_UNIX
>> > os.chdir(os.path.dirname(path))
>> > - self.server = self.loop.run_until_complete(
>> > - asyncio.start_unix_server(self.handle_client, os.path.basename(path))
>> > - )
>> > + if sys.version_info[0] == 3 and sys.version_info[1] < 6:
>> > + self.server = self.loop.run_until_complete(
>> > + asyncio.start_unix_server(self.handle_client, os.path.basename(path), loop=self.loop)
>> > + )
>> > + else:
>> > + self.server = self.loop.run_until_complete(
>> > + asyncio.start_unix_server(self.handle_client, os.path.basename(path))
>> > + )
>> > finally:
>> > os.chdir(cwd)
>> >
>> > --
>> > 2.25.1
>> >
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-01-21 16:31 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-21 14:51 [bitbake][dunfell][1.46][PATCH v2] hashserv: specify loop for asyncio in python < 3.6 Jate Sujjavanich
2022-01-21 14:55 ` Steve Sakoman
2022-01-21 16:05 ` Jate Sujjavanich
2022-01-21 16:31 ` Steve Sakoman
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.