Project

General

Profile

Actions

Bug #62140

closed

pybind/rbd/rbd.pyx does not build with Cython-3

Added by Kaleb KEITHLEY 9 months ago. Updated 2 months ago.

Status:
Resolved
Priority:
Normal
Assignee:
Target version:
-
% Done:

0%

Source:
Community (dev)
Tags:
backport_processed
Backport:
reef
Regression:
No
Severity:
2 - major
Reviewed:
ceph-qa-suite:
Pull request ID:
Crash signature (v1):
Crash signature (v2):

Description

Fedora rawhide (a.k.a. f39) has updated Cython to Cython-3 (from Cython-0.29)

Builds now fail with the following errors:

...
cd /builddir/build/BUILD/ceph-18.1.2/src/pybind/rbd && env CC="/usr/bin/gcc" CFLAGS="" CPPFLAGS="-iquote/builddir/build/BUILD/ceph-18.1.2/src/include -w -D'void0=dead_function(void)' -D'__Pyx_check_single_interpreter(ARG)=ARG##0'" CXX="/usr/bin/g++" LDSHARED="/usr/bin/gcc -shared" OPT="-DNDEBUG -g -fwrapv -O2 -w" LDFLAGS=-L/builddir/build/BUILD/ceph-18.1.2/redhat-linux-build/lib CYTHON_BUILD_DIR=/builddir/build/BUILD/ceph-18.1.2/redhat-linux-build/src/pybind/rbd CEPH_LIBDIR=/builddir/build/BUILD/ceph-18.1.2/redhat-linux-build/lib /usr/bin/python3.12 /builddir/build/BUILD/ceph-18.1.2/src/pybind/rbd/setup.py build --build-base /builddir/build/BUILD/ceph-18.1.2/redhat-linux-build/lib/cython_modules --build-platlib /builddir/build/BUILD/ceph-18.1.2/redhat-linux-build/lib/cython_modules/lib.3
/builddir/build/BUILD/ceph-18.1.2/src/pybind/rbd/setup.py:8: DeprecationWarning: 'pkgutil.find_loader' is deprecated and slated for removal in Python 3.14; use importlib.util.find_spec() instead
  if not pkgutil.find_loader('setuptools'):
warning: rbd.pyx:36:0: The 'IF' statement is deprecated and will be removed in a future Cython version. Consider using runtime conditions or C macros instead. See https://github.com/cython/cython/issues/4310
warning: rbd.pyx:361:0: The 'IF' statement is deprecated and will be removed in a future Cython version. Consider using runtime conditions or C macros instead. See https://github.com/cython/cython/issues/4310
warning: c_rbd.pxd:596:48: The keyword 'nogil' should appear at the end of the function signature line. Placing it before 'except' or 'noexcept' will be disallowed in a future version of Cython.
warning: ../rados/rados.pxd:7:0: The 'IF' statement is deprecated and will be removed in a future Cython version. Consider using runtime conditions or C macros instead. See https://github.com/cython/cython/issues/4310
Error compiling Cython file:
------------------------------------------------------------
...
        """ 
        name = cstr(name, 'name')
        cdef:
            rados_ioctx_t _ioctx = convert_ioctx(ioctx)
            char *_name = name
            librbd_progress_fn_t _prog_cb = &no_op_progress_callback
                                            ^
------------------------------------------------------------
rbd.pyx:760:44: Cannot assign type 'int (*)(uint64_t, uint64_t, void *) except -1' to 'librbd_progress_fn_t'
Error compiling Cython file:
------------------------------------------------------------
...
            rados_ioctx_t _ioctx = convert_ioctx(ioctx)
            char *_name = name
            librbd_progress_fn_t _prog_cb = &no_op_progress_callback
            void *_prog_arg = NULL
        if on_progress:
            _prog_cb = &progress_callback
                       ^
------------------------------------------------------------
rbd.pyx:763:23: Cannot assign type 'int (*)(uint64_t, uint64_t, void *) except -1' to 'librbd_progress_fn_t'
Error compiling Cython file:
------------------------------------------------------------
...
        image_id = cstr(image_id, 'image_id')
        cdef:
            rados_ioctx_t _ioctx = convert_ioctx(ioctx)
            char *_image_id = image_id
            int _force = force
            librbd_progress_fn_t _prog_cb = &no_op_progress_callback
                                            ^
------------------------------------------------------------
rbd.pyx:868:44: Cannot assign type 'int (*)(uint64_t, uint64_t, void *) except -1' to 'librbd_progress_fn_t'
Error compiling Cython file:
------------------------------------------------------------
...
            char *_image_id = image_id
            int _force = force
            librbd_progress_fn_t _prog_cb = &no_op_progress_callback
            void *_prog_arg = NULL
        if on_progress:
            _prog_cb = &progress_callback
                       ^
------------------------------------------------------------
rbd.pyx:871:23: Cannot assign type 'int (*)(uint64_t, uint64_t, void *) except -1' to 'librbd_progress_fn_t'
Error compiling Cython file:
------------------------------------------------------------
...
        """ 
        image_name = cstr(image_name, 'image_name')
        cdef:
            rados_ioctx_t _ioctx = convert_ioctx(ioctx)
            char *_image_name = image_name
            librbd_progress_fn_t _prog_cb = &no_op_progress_callback
                                            ^
------------------------------------------------------------
rbd.pyx:1097:44: Cannot assign type 'int (*)(uint64_t, uint64_t, void *) except -1' to 'librbd_progress_fn_t'
Error compiling Cython file:
------------------------------------------------------------
...
            rados_ioctx_t _ioctx = convert_ioctx(ioctx)
            char *_image_name = image_name
            librbd_progress_fn_t _prog_cb = &no_op_progress_callback
            void *_prog_arg = NULL
        if on_progress:
            _prog_cb = &progress_callback
                       ^
------------------------------------------------------------
rbd.pyx:1100:23: Cannot assign type 'int (*)(uint64_t, uint64_t, void *) except -1' to 'librbd_progress_fn_t'
Error compiling Cython file:
------------------------------------------------------------
...
        """ 
        image_name = cstr(image_name, 'image_name')
        cdef:
            rados_ioctx_t _ioctx = convert_ioctx(ioctx)
            char *_image_name = image_name
            librbd_progress_fn_t _prog_cb = &no_op_progress_callback
                                            ^
------------------------------------------------------------
rbd.pyx:1124:44: Cannot assign type 'int (*)(uint64_t, uint64_t, void *) except -1' to 'librbd_progress_fn_t'
Error compiling Cython file:
------------------------------------------------------------
...
            rados_ioctx_t _ioctx = convert_ioctx(ioctx)
            char *_image_name = image_name
            librbd_progress_fn_t _prog_cb = &no_op_progress_callback
            void *_prog_arg = NULL
        if on_progress:
            _prog_cb = &progress_callback
                       ^
------------------------------------------------------------
rbd.pyx:1127:23: Cannot assign type 'int (*)(uint64_t, uint64_t, void *) except -1' to 'librbd_progress_fn_t'
Error compiling Cython file:
------------------------------------------------------------
...
        """ 
        image_name = cstr(image_name, 'image_name')
        cdef:
            rados_ioctx_t _ioctx = convert_ioctx(ioctx)
            char *_image_name = image_name
            librbd_progress_fn_t _prog_cb = &no_op_progress_callback
                                            ^
------------------------------------------------------------
rbd.pyx:1151:44: Cannot assign type 'int (*)(uint64_t, uint64_t, void *) except -1' to 'librbd_progress_fn_t'
Error compiling Cython file:
------------------------------------------------------------
...
            rados_ioctx_t _ioctx = convert_ioctx(ioctx)
            char *_image_name = image_name
            librbd_progress_fn_t _prog_cb = &no_op_progress_callback
            void *_prog_arg = NULL
        if on_progress:
            _prog_cb = &progress_callback
                       ^
------------------------------------------------------------
rbd.pyx:1154:23: Cannot assign type 'int (*)(uint64_t, uint64_t, void *) except -1' to 'librbd_progress_fn_t'
Error compiling Cython file:
------------------------------------------------------------
...
        cdef:
            rbd_completion_t completion
            PyObject* p_completion_obj= <PyObject*>completion_obj
        with nogil:
            ret = rbd_aio_create_completion(p_completion_obj, __aio_complete_cb,
                                                              ^
------------------------------------------------------------
rbd.pyx:2927:62: Cannot assign type 'void (rbd_completion_t, void *) except * nogil' to 'rbd_callback_t'
Error compiling Cython file:
------------------------------------------------------------
...
        if not allow_shrink and old_size > size:
            raise InvalidArgument("error allow_shrink is False but old_size > new_size")
        cdef:
            uint64_t _size = size
            bint _allow_shrink = allow_shrink
            librbd_progress_fn_t prog_cb = &no_op_progress_callback
                                           ^
------------------------------------------------------------
rbd.pyx:3007:43: Cannot assign type 'int (*)(uint64_t, uint64_t, void *) except -1' to 'librbd_progress_fn_t'
Error compiling Cython file:
------------------------------------------------------------
...
        """ 
        name = cstr(name, 'name')
        cdef:
            char *_name = name
            uint32_t _flags = flags
            librbd_progress_fn_t prog_cb = &no_op_progress_callback
                                           ^
------------------------------------------------------------
rbd.pyx:3511:43: Cannot assign type 'int (*)(uint64_t, uint64_t, void *) except -1' to 'librbd_progress_fn_t'
Error compiling Cython file:
------------------------------------------------------------
...
        name = cstr(name, 'name')
        cdef:
            char *_name = name
            uint32_t _flags = flags
            librbd_progress_fn_t prog_cb = &no_op_progress_callback
                                           ^
------------------------------------------------------------
rbd.pyx:3570:43: Cannot assign type 'int (*)(uint64_t, uint64_t, void *) except -1' to 'librbd_progress_fn_t'
Error compiling Cython file:
------------------------------------------------------------
...
        Flatten clone image (copy all blocks from parent to child)
        :param on_progress: optional progress callback function
        :type on_progress: callback function
        """ 
        cdef:
            librbd_progress_fn_t _prog_cb = &no_op_progress_callback
                                            ^
------------------------------------------------------------
rbd.pyx:4085:44: Cannot assign type 'int (*)(uint64_t, uint64_t, void *) except -1' to 'librbd_progress_fn_t'
Error compiling Cython file:
------------------------------------------------------------
...
        """ 
        cdef:
            librbd_progress_fn_t _prog_cb = &no_op_progress_callback
            void *_prog_arg = NULL
        if on_progress:
            _prog_cb = &progress_callback
                       ^
------------------------------------------------------------
rbd.pyx:4088:23: Cannot assign type 'int (*)(uint64_t, uint64_t, void *) except -1' to 'librbd_progress_fn_t'
Error compiling Cython file:
------------------------------------------------------------
...
    @requires_not_closed
    def rebuild_object_map(self):
        """ 
        Rebuild the object map for the image HEAD or currently set snapshot
        """ 
        cdef librbd_progress_fn_t prog_cb = &no_op_progress_callback
                                            ^
------------------------------------------------------------
rbd.pyx:4112:44: Cannot assign type 'int (*)(uint64_t, uint64_t, void *) except -1' to 'librbd_progress_fn_t'
Compiling rbd.pyx because it changed.
[1/1] Cythonizing rbd.pyx
Traceback (most recent call last):
  File "/builddir/build/BUILD/ceph-18.1.2/src/pybind/rbd/setup.py", line 192, in <module>
    ext_modules=cythonize(
                ^^^^^^^^^^
  File "/usr/lib64/python3.12/site-packages/Cython/Build/Dependencies.py", line 1134, in cythonize
    cythonize_one(*args)
  File "/usr/lib64/python3.12/site-packages/Cython/Build/Dependencies.py", line 1301, in cythonize_one
    raise CompileError(None, pyx_file)
Cython.Compiler.Errors.CompileError: rbd.pyx
...

full log at https://kojipkgs.fedoraproject.org//work/tasks/4604/103744604/build.log for a limited amount of time. Note the warnings too.

I used the following patch:

--- ceph-18.1.2/src/pybind/rbd/rbd.pyx.orig    2023-07-21 13:30:08.156825317 -0400
+++ ceph-18.1.2/src/pybind/rbd/rbd.pyx    2023-07-24 09:09:27.930137117 -0400
@@ -371,10 +371,10 @@
     cdef rados_ioctx_t convert_ioctx(rados.Ioctx ioctx) except? NULL:
         return <rados_ioctx_t>ioctx.io

-cdef int progress_callback(uint64_t offset, uint64_t total, void* ptr) with gil:
+cdef int progress_callback(uint64_t offset, uint64_t total, void* ptr) noexcept with gil:
     return (<object>ptr)(offset, total)

-cdef int no_op_progress_callback(uint64_t offset, uint64_t total, void* ptr):
+cdef int no_op_progress_callback(uint64_t offset, uint64_t total, void* ptr) noexcept with gil:
     return 0

 def cstr(val, name, encoding="utf-8", opt=False):
@@ -426,7 +426,7 @@

 cdef class Completion

-cdef void __aio_complete_cb(rbd_completion_t completion, void *args) with gil:
+cdef void __aio_complete_cb(rbd_completion_t completion, void *args) noexcept with gil:
     """ 
     Callback to oncomplete() for asynchronous operations
     """ 


Related issues 1 (0 open1 closed)

Copied to rbd - Backport #63733: reef: pybind/rbd/rbd.pyx does not build with Cython-3ResolvedMykola GolubActions
Actions #1

Updated by Laura Flores 9 months ago

Hey Kaleb, is this issue in any way related to https://tracker.ceph.com/issues/62291?

Actions #2

Updated by Ilya Dryomov 9 months ago

  • Status changed from New to Fix Under Review
  • Assignee set to Kaleb KEITHLEY
  • Target version deleted (v18.2.0)
  • Pull request ID set to 52794
Actions #3

Updated by Kaleb KEITHLEY 9 months ago

  • Assignee deleted (Kaleb KEITHLEY)
  • Affected Versions v18.1.3, v18.2.0 added
Actions #4

Updated by Ilya Dryomov 9 months ago

  • Status changed from Fix Under Review to New
  • Pull request ID deleted (52794)
Actions #5

Updated by Kefu Chai 8 months ago

  • Description updated (diff)
Actions #6

Updated by Ilya Dryomov 5 months ago

  • Status changed from New to Fix Under Review
  • Assignee set to Mykola Golub
  • Pull request ID set to 54670
Actions #7

Updated by Ilya Dryomov 5 months ago

  • Status changed from Fix Under Review to Pending Backport
  • Backport set to reef
Actions #8

Updated by Backport Bot 5 months ago

  • Copied to Backport #63733: reef: pybind/rbd/rbd.pyx does not build with Cython-3 added
Actions #9

Updated by Backport Bot 5 months ago

  • Tags set to backport_processed
Actions #10

Updated by Backport Bot 2 months ago

  • Status changed from Pending Backport to Resolved

While running with --resolve-parent, the script "backport-create-issue" noticed that all backports of this issue are in status "Resolved" or "Rejected".

Actions

Also available in: Atom PDF