Rocket U2 | UniVerse & UniData

 View Only
  • 1.  Python crashing Universe when using hashlib library

    Posted 10-19-2021 13:31
    After upgrading from UV 11.3.3 to 11.3.4 I am having an issue causing Universe to crash. I am using the Pymysql library to read/write to a remote MariaDB Database, the same code worked fine before the update and is now crashing on run. What I have figured out so far:
    • The issue is caused within the pymysql's connect() function. After adding some fault handling and looking at the trace (attached pythoncrash program.txt) sends me on a rabbit hole that ends in pymysql's _auth.py file. the scramble_native_password function on line 29. Specifically on line 34 when Hashlib runs the digest() function. I can recreate the issue with the functions directly from hashlib (pythoncrash TCL.txt) and I get the same issue.
    • As a test I try to run a simple script that builds a hash and runs a digest....I crash when running from TCL, but I run successfully when calling from shell, telling me this is an issue somehow localized to Universe, and the changes in the 11.3.3 > 11.3.4 upgrade.
      • /usr/uv/python/bin/python3  mytest.py
    • Hashlib allows you to choose other hash methods than SHA1, I have tried with SHA256, MD5 and still have the issue.
    • I have verified that I can connect to the MariaDB from shell with a mysql command
    • I did try the REINIT.PYTHON OFF/ON commands with no change to my results.
    I notice in the attached files that the issue appears to be coming from the libpython3.9.so files telling me there might be something broken in the way that Universe Python is using the C libraries, specifically around password/auth hashing.

    Minimum working code example below:
    def main():
        psswd = "test1234".encode('utf-8')
        import hashlib
        test_hash = hashlib.new('sha256', psswd)
        test_digest= test_hash.digest()
    ​

    I would also love to know if anyone else can replicate this issue. Hashlib is part of the standard Python library, right now my issue is when I use pymysql, but my understanding is that many other libraries (requests library comes to mind) also use hashlib in the underlying logic.

    Thanks for any assistance people can offer, I will keep updating this thread as I play around more.

    ------------------------------
    Nic Davidson
    Developer
    Combined Transport Inc
    Medford OR United States
    ------------------------------


  • 2.  RE: Python crashing Universe when using hashlib library

    ROCKETEER
    Posted 11-04-2021 23:12
    Hi, Nic.

    Apologize for the delay response on this one, we have received a customer case from Software Management this morning for this.
    I have reproduced this core dump issue in UV 11.3.4 release too, I will report a bug ticket for this issue today.

    [chan@waldevtsmvhan03 XDEMO]$ uvsh
    UniVerse Command Language 11.3
    Copyright Rocket Software, Inc. or its affiliates, All Rights Reserved 1985-2021
    XDEMO logged on: Thu Nov  4 20:54:00 2021

    Warning: UniVerse has not been authorized! You have 10 day(s)
             to call U2 before UniVerse stops working.


    Welcome to the XDEMO Account
    Version: 3.1.5

    >PYTHON
    python> psswd = "test1234".encode('utf-8')
    python> import hashlib
    python> test_hash = hashlib.new('sha256', psswd)
    python> test_digest= test_hash.digest()
    Abnormal termination of UniVerse.
    Fault type is 11.  Layer type is Unknown.
    Segmentation fault (core dumped)

    ------------------------------
    Chao Han
    Rocket Internal - All Brands
    Dalian China
    ------------------------------