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

Beta repository lacks i386 builds #3198

Closed
basilgello opened this issue Jul 13, 2021 · 16 comments
Closed

Beta repository lacks i386 builds #3198

basilgello opened this issue Jul 13, 2021 · 16 comments

Comments

@basilgello
Copy link
Contributor

I faced this today trying to deploy a container to test a bug in Kodi i386. Of course I can build both packages, but Xpra users will unlikely do it :)

@basilgello
Copy link
Contributor Author

Got the following signed-vs-unsigned comparison errors with GCC 10 on i386:
xpra-i386-build-error.log

I guess there are more since len() returns Py_ssize_t which is 32-bit on i386.

@totaam
Copy link
Collaborator

totaam commented Jul 13, 2021

32-bit builds are no longer supported.. as you just found out.
Making releases takes long enough, I really don't want to double the time it takes to produce the Linux builds.

That said, the compilation bug should be fixed.

@basilgello can you copy one of the parts of the argb.c source file that matches the error?
ie:

xpra/codecs/argb/argb.c:3473:40: error: comparison of integer expressions of different signedness: 'Py_ssize_t' {aka 'int'} and 'unsigned int' [-Werror=sign-compare]
 3473 |             if (unlikely(!((__pyx_t_10 >= (__pyx_v_h * __pyx_v_src_stride)) != 0))) {
      |                                        ^~

Lines around 3473 should point us to the pyx source.
My guess is that it is the new buffer_context object.
We use the magic method __int__ to convert it to a pointer, but perhaps all the calls need to be changed like so (done for just one caller):

diff --git a/xpra/buffers/membuf.pyx b/xpra/buffers/membuf.pyx
index 1d25d90ff..c648e66a6 100644
--- a/xpra/buffers/membuf.pyx
+++ b/xpra/buffers/membuf.pyx
@@ -112,7 +112,9 @@ cdef class BufferContext:
         PyBuffer_Release(&self.py_buf)
     def __int__(self):
         assert self.py_buf.buf
-        return int(<uintptr_t> self.py_buf.buf)
+        return <uintptr_t> self.py_buf.buf
+    cdef uintptr_t getptr(self):
+        return <uintptr_t> self.py_buf.buf
     def __len__(self):
         return self.py_buf.len
     def __repr__(self):
diff --git a/xpra/codecs/argb/argb.pyx b/xpra/codecs/argb/argb.pyx
index 976a1b4f9..ea244dd7f 100644
--- a/xpra/codecs/argb/argb.pyx
+++ b/xpra/codecs/argb/argb.pyx
@@ -76,9 +76,11 @@ def r210_to_rgba(buf,
     assert w*4<=src_stride, "invalid source stride %i for width %i" % (src_stride, w)
     assert w*4<=dst_stride, "invalid destination stride %i for width %i" % (dst_stride, w)
     cdef unsigned int* r210
+    cdef uintptr_t ptr
     with buffer_context(buf) as bc:
         assert len(bc)>=h*src_stride, "source buffer is %i bytes, which is too small for %ix%i" % (len(bc), src_stride, h)
-        r210 = <unsigned int*> (<uintptr_t> int(bc))
+        ptr = bc.getptr()
+        r210 = <unsigned int*> (<uintptr_t> ptr)
         return r210data_to_rgba(r210, w, h, src_stride, dst_stride)
 
 cdef r210data_to_rgba(unsigned int* r210,

Which would be annoying.

@basilgello
Copy link
Contributor Author

basilgello commented Jul 13, 2021

@totaam This one passed the build on i386, let me see if it actually works for amd64:
i386.patch.txt

@basilgello
Copy link
Contributor Author

basilgello commented Jul 13, 2021

32-bit builds are no longer supported.. as you just found out.

In Debian, there are 12 supported architectures, including s390x or ppc64el so I have to support even them. In fact, not me but Debian's Xpra maintainer @onlyjob :) But since I am now more interested in latest Xpra features, I stepped into fixing bugs :)

totaam added a commit that referenced this issue Jul 13, 2021
@basilgello
Copy link
Contributor Author

Adventure goes on...

2021-07-13 17:16:39,422 swscale: testing YUV420P / BGRX
--- Logging error ---
Traceback (most recent call last):
  File "/usr/lib/python3.9/logging/__init__.py", line 1079, in emit
    msg = self.format(record)
  File "/usr/lib/python3/dist-packages/xpra/colorstreamhandler.py", line 60, in format
    text = super().format(record)
  File "/usr/lib/python3.9/logging/__init__.py", line 923, in format
    return fmt.format(record)
  File "/usr/lib/python3.9/logging/__init__.py", line 661, in format
    record.asctime = self.formatTime(record, self.datefmt)
  File "/usr/lib/python3.9/logging/__init__.py", line 602, in formatTime
    s = self.default_msec_format % (s, record.msecs)
ValueError: cannot convert float NaN to integer
Call stack:
  File "/usr/lib/python3.9/threading.py", line 912, in _bootstrap
    self._bootstrap_inner()
  File "/usr/lib/python3.9/threading.py", line 954, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.9/threading.py", line 892, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/lib/python3/dist-packages/xpra/server/server_base.py", line 167, in threaded_init
    c.threaded_setup(self)
  File "/usr/lib/python3/dist-packages/xpra/server/mixins/encoding_server.py", line 55, in threaded_setup
    getVideoHelper().init()
  File "/usr/lib/python3/dist-packages/xpra/codecs/video_helper.py", line 234, in init
    self.init_csc_options()
  File "/usr/lib/python3/dist-packages/xpra/codecs/video_helper.py", line 310, in init_csc_options
    load_codec(mod)
  File "/usr/lib/python3/dist-packages/xpra/codecs/loader.py", line 184, in load_codec
    xpra_codec_import(name, description, top_module, class_module, classnames)
  File "/usr/lib/python3/dist-packages/xpra/codecs/loader.py", line 141, in xpra_codec_import
    if codec_import_check(name, description, xpra_top_module, xpra_class_module, classname):
  File "/usr/lib/python3/dist-packages/xpra/codecs/loader.py", line 71, in codec_import_check
    selftest(FULL_SELFTEST)
  File "/usr/lib/python3/dist-packages/xpra/codecs/codec_checks.py", line 266, in testcsc
    log("test_csc(%s, %s, %s, %s)", csc_module, full, test_cs_in, test_cs_out)
  File "/usr/lib/python3/dist-packages/xpra/log.py", line 432, in __call__
    self.log(logging.DEBUG, msg, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/xpra/log.py", line 428, in log
    global_logging_handler(self.logger.log, self.level_override or level, msg, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/xpra/log.py", line 145, in standard_logging
    log(level, msg, *args, **kwargs)
Message: 'test_csc(%s, %s, %s, %s)'
Arguments: (<module 'xpra.codecs.csc_swscale.colorspace_converter' from '/usr/lib/python3/dist-packages/xpra/codecs/csc_swscale/colorspace_converter.cpython-39-i386-linux-gnu.so'>, False, ['BGRX'], ['YUV420P'])
2021-07-13 17:16:39,426 do_testcsc(<module 'xpra.codecs.csc_swscale.colorspace_converter' from '/usr/lib/python3/dist-packages/xpra/codecs/csc_swscale/colorspace_converter.cpython-39-i386-linux-gnu.so'>, 48, 32, 48, 32, False, ['BGRX'], ['YUV420P'], 8192, 8192)
2021-07-13 17:16:39,426 swscale: testing BGRX / YUV420P
Segmentation fault

@totaam
Copy link
Collaborator

totaam commented Jul 13, 2021

ValueError: cannot convert float NaN to integer

This one is actually scarier: it may come from memory corruption somewhere else.

Segmentation fault

I would just disable all ffmpeg based codecs on i386.
Unfortunately, there's no libyuv on Debian to replace csc_swscale.

@basilgello
Copy link
Contributor Author

The power of GDB shows that first call to sws_scale passes:

Thread 19 "python3" hit Breakpoint 1, sws_scale (c=0xecfd9600, srcSlice=0xe58ba0c0, srcStride=0xe58ba0e0, srcSliceY=0, srcSliceH=32, dst=0xe58ba0d0, dstStride=0xf73c0df8) at src/libswscale/swscale.c:749
749	src/libswscale/swscale.c: No such file or directory.
(gdb) py-bt-full
#6 Frame 0xf4c71728, for file /usr/lib/python3/dist-packages/xpra/codecs/codec_checks.py, line 310, in do_testcsc (csc_module=<module at remote 0xf4863af0>, iw=48, ih=32, ow=48, oh=32, full=False, test_cs_in=['YUV420P'], test_cs_out=['BGRX'], limit_w=8192, limit_h=8192, cs_in_list=[...], cs_in='YUV420P', cs_out_list=[...], cs_out='BGRX', e=<xpra.codecs.csc_swscale.colorspace_converter.ColorspaceConverter at remote 0xf73c0da8>, image=<ImageWrapper(x=0, y=0, target_x=0, target_y=0, width=48, height=32, pixels=[b'                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ...(truncated)
    out = e.convert_image(image)
#13 Frame 0xf48681a8, for file /usr/lib/python3/dist-packages/xpra/codecs/codec_checks.py, line 267, in testcsc (csc_module=<module at remote 0xf4863af0>, scaling=True, full=False, test_cs_in=['YUV420P'], test_cs_out=['BGRX'], W=48, H=32)
    do_testcsc(csc_module, W, H, W, H, full, test_cs_in, test_cs_out)
#21 <built-in function selftest>
#27 Frame 0xf4beb6c8, for file /usr/lib/python3/dist-packages/xpra/codecs/loader.py, line 71, in codec_import_check (name='csc_swscale', description='swscale colorspace conversion', top_module='xpra.codecs.csc_swscale', class_module='xpra.codecs.csc_swscale.colorspace_converter', classnames=('ColorspaceConverter',), classname='ColorspaceConverter', ic=<module at remote 0xf4863af0>, init_module=<built-in function init_module>, clazz=<type at remote 0xe9fc1380>, selftest=<built-in function selftest>)
    selftest(FULL_SELFTEST)
#34 Frame 0xf48a9028, for file /usr/lib/python3/dist-packages/xpra/codecs/loader.py, line 141, in xpra_codec_import (name='csc_swscale', description='swscale colorspace conversion', top_module='csc_swscale', class_module='colorspace_converter', classname=('ColorspaceConverter',), xpra_top_module='xpra.codecs.csc_swscale', xpra_class_module='xpra.codecs.csc_swscale.colorspace_converter')

But second call trashes:

Thread 19 "python3" hit Breakpoint 1, sws_scale (c=0xecfd9600, srcSlice=0xe58ba0c0, srcStride=0xe58ba0e0, srcSliceY=0, srcSliceH=32, dst=0xe58ba0d0, dstStride=0xf73c0df8) at src/libswscale/swscale.c:749
749	in src/libswscale/swscale.c
(gdb) py-bt-full
#6 Frame 0xf4c71728, for file /usr/lib/python3/dist-packages/xpra/codecs/codec_checks.py, line 310, in do_testcsc (csc_module=<module at remote 0xf4863af0>, iw=48, ih=32, ow=48, oh=32, full=False, test_cs_in=['BGRX'], test_cs_out=['YUV420P'], limit_w=8192, limit_h=8192, cs_in_list=[...], cs_in='BGRX', cs_out_list=[...], cs_out='YUV420P', e=<xpra.codecs.csc_swscale.colorspace_converter.ColorspaceConverter at remote 0xf73c0da8>, image=<ImageWrapper(x=0, y=0, target_x=0, target_y=0, width=48, height=32, pixels=b'                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ...(truncated)
    out = e.convert_image(image)
#13 Frame 0xf48681a8, for file /usr/lib/python3/dist-packages/xpra/codecs/codec_checks.py, line 267, in testcsc (csc_module=<module at remote 0xf4863af0>, scaling=True, full=False, test_cs_in=['BGRX'], test_cs_out=['YUV420P'], W=48, H=32)
    do_testcsc(csc_module, W, H, W, H, full, test_cs_in, test_cs_out)
#21 <built-in function selftest>
#27 Frame 0xf4beb6c8, for file /usr/lib/python3/dist-packages/xpra/codecs/loader.py, line 71, in codec_import_check (name='csc_swscale', description='swscale colorspace conversion', top_module='xpra.codecs.csc_swscale', class_module='xpra.codecs.csc_swscale.colorspace_converter', classnames=('ColorspaceConverter',), classname='ColorspaceConverter', ic=<module at remote 0xf4863af0>, init_module=<built-in function init_module>, clazz=<type at remote 0xe9fc1380>, selftest=<built-in function selftest>)
    selftest(FULL_SELFTEST)
#34 Frame 0xf48a9028, for file /usr/lib/python3/dist-packages/xpra/codecs/loader.py, line 141, in xpra_codec_import (name='csc_swscale', description='swscale colorspace conversion', top_module='csc_swscale', class_module='colorspace_converter', classname=('ColorspaceConverter',), xpra_top_module='xpra.codecs.csc_swscale', xpra_class_module='xpra.codecs.csc_swscale.colorspace_converter')
Thread 19 "python3" received signal SIGSEGV, Segmentation fault.
0xe9f4e104 in ff_yuv2plane1_8_sse2.unaligned () at src//libavutil/x86/x86util.asm:1316
1316	src//libavutil/x86/x86util.asm: No such file or directory.
(gdb) bt full
#0  0xe9f4e104 in ff_yuv2plane1_8_sse2.unaligned () at src//libavutil/x86/x86util.asm:1316

@basilgello
Copy link
Contributor Author

I would just disable all ffmpeg based codecs on i386.

How do I do it?

@totaam
Copy link
Collaborator

totaam commented Jul 13, 2021

How do I do it?

OTOH: --without-csc_swscale --without-enc_ffmpeg --without-dec_avcodec2

@basilgello
Copy link
Contributor Author

Ya, removing the appropriate codec solibs did the trick, too (as a quick test)

@basilgello
Copy link
Contributor Author

https://salsa.debian.org/basilgello/xpra/-/commit/30cf671623792526467cdb747d6b82b2803b7ee7

totaam added a commit that referenced this issue Jul 14, 2021
@totaam
Copy link
Collaborator

totaam commented Jul 14, 2021

@basilgello thanks - applied above

IIRC, Debian doesn't use a patched dummy driver, so why use Xdummy instead of Xvfb?

@basilgello
Copy link
Contributor Author

use Xdummy instead of Xvfb?

It has both Xvfb and Xdummy as deps. It was like that since 3.0 packaged in Debian so I did not touch that part :)

@totaam
Copy link
Collaborator

totaam commented Jul 14, 2021

It has both Xvfb and Xdummy as deps

BUILDOPTS= --with-verbose --with-Xdummy --without-Xdummy_wrapper $(EXTRA_BUILDOPTS)

So the config you ship will use Xdummy


I think we can finally close this ticket, right?

@totaam totaam closed this as completed Jul 14, 2021
@basilgello
Copy link
Contributor Author

So the config you ship will use Xdummy

With https://salsa.debian.org/basilgello/xpra/-/blame/master/debian/control#L51 I did not notice Xpra starts,with Xdummy as default:

$ ps uxw
test   132225 12.9  0.8 1470792 144420 ?      SLl  07:34   0:01 /usr/bin/python3 /usr/bin/xpra start
test   132228  2.7  1.1 1466948 180252 ?      Sl   07:34   0:00 Xvfb-for-Xpra-S132222 +extension GLX +extension Composite -screen 0 8192x4096x24+32 -nolist… 
test   132252  0.1  0.0   8040  3168 ?        Ss   07:34   0:00 /usr/bin/dbus-daemon --syslog-only --fork --print-pid 5 --print-address 7 --sessio… 
test   132272  0.2  0.0 240188  9636 ?        Sl   07:34   0:00 /usr/libexec/gvfs… 

@totaam
Copy link
Collaborator

totaam commented Jul 14, 2021

test 132228 2.7 1.1 1466948 180252 ? Sl 07:34 0:00 Xvfb-for-Xpra-S132222 +extension GLX +extension Composite -screen 0 8192x4096x24+32 -nolist…

Yup. That's Xvfb alright. No idea why since your build file sets --with-Xdummy.

totaam added a commit that referenced this issue Jul 14, 2021
totaam added a commit that referenced this issue Jul 15, 2021
totaam added a commit that referenced this issue Jul 15, 2021
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