Rocket U2 | UniVerse & UniData

 View Only

 uv 11.3 on linux : compiler error !?

Manu Fernandes's profile image
PARTNER Manu Fernandes posted 02-02-2024 08:04

hello folks,

on a Linux/uv 11.3 box, I have a trouble with BASIC 

I do this (for short): 
equ UUID$NEW lit "field(PyGetAttr(PyCallFunction('uuid', 'uuid4'), 'urn'),':',3)" 
print UUID$NEW

and I get a segmentation fault at runtime AND with VLIST ; 
basic pcode seams faulty ?
echo of command
It works for month ; and it works on another machines.... 
After a reboot of the os the trouble is still there !!!
Any idea ? 
many thanks by advance
ManuFV
Neil Morris's profile image
ROCKETEER Neil Morris

Hi Manu,

Are the 3 systems involved all running the same version of UV on the same platform?

I was thinking version of UV or platform could be a factor. Although you indicate it worked previously on this same machine with the same version of UV?

Is it the exact same code on all 3 platforms? No possibility of any control characters in the failing system?

You are correct that the object code looks incorrect. The PyCallFunction is being interpreted incorrectly. It is defining 2 as the first argument and sending the results to the second argument. 

What version of UV is running on the failing system?

Neil

Manu Fernandes's profile image
PARTNER Manu Fernandes

Hi Neil. 

Release is 11.3.0 /linux & Windows (ok) 

Yes it worked on it from month.

I have got the crash (faut) during test on the main program, I develop from 3 weeks without a trouble. I do not change these part of the code. 

No special chars on the code trouble occurs only on these box from this morning.

Thank you for help. 

Manu Fernandes's profile image
PARTNER Manu Fernandes

The most strange is, I extract the line from a 1500 line's code and Compile it alone and the problem occurs ! 

Neil Morris's profile image
ROCKETEER Neil Morris

Hi Manu,

Just confirming. Are you actually running UV Version 11.3.0? 

That release was created to provide early access to some new Replication functionality before 11.3.1 was released. 

I'm thinking the 11.3.0 was a typo?

Thanks,

Neil

Manu Fernandes's profile image
PARTNER Manu Fernandes

Something is broken at 'nbasic' level but what ? 

Manu Fernandes's profile image
PARTNER Manu Fernandes

Yes

11.3.0, installed from years

But I confirm it worked until today... The trouble is not the release.

Thank you

Neil Morris's profile image
ROCKETEER Neil Morris

Is the failure specific to that line of code? That is, do other items compile and run successfully? 

Any timedate stamp changes on any of the binaries in uvhome/bin or anything else in uvhome? 

Not sure how this would just start misbehaving. Something must have changed but what?

Manu Fernandes's profile image
PARTNER Manu Fernandes

Yes that line of code....

I'll check /uv... 

Thank you for your help 

Manu Fernandes's profile image
PARTNER Manu Fernandes

hi Neil, ... 

a little code with

print date()
A=1
A=PyCallFunction('UUID','UUID') 

on my problematic machine, the VLIST show bad assignment and crash.

Compiler Version: 11.3.0.0                              
Object Level    : 5                                     
Machine Type    : 1                                     
Local Variables : 1                                     
Subroutine args : 0                                     
Unnamed Common  : 0                                     
Named Common Seg: 0                                     
Object Size     : 28                                    
Source lines    : 3                                     
Object Date Time: 05 FEB 2024 08:54:52                  
                                                        
00001: PRINT DATE()                                     
00001 00000 : 04E date            => $R0                
00001 00004 : 130 printcrlf      $R0                    
                                                        
00002: A=1                                              
00002 0000A : 0F8 move           1  => A                
                                                        
00003: A=PYCALLFUNCTION('UUID','UUID')                  
00003 00010 : 55A PyCallFunction 2 "UUID"  => "UUID"    
00003 00018 : 001 abort                                 
00003 0001A : 190 stop                                  

if I copy the object code to another machine, and perform VLIST I get the correct pcode and the program run properly

>VLIST BP TEST.o
Main Program "BP.O/TEST.o"
Compiler Version: 11.3.0.0
Object Level    : 5
Machine Type    : 11
Local Variables : 1
Subroutine args : 0
Unnamed Common  : 0
Named Common Seg: 0
Object Size     : 28
Source lines    : 3
Object Date Time: 05 FEB 2024 08:54:52
00001 00000 : 04E date            => $R0
00001 00004 : 130 printcrlf      $R0

00002 0000A : 0F8 move           1  => A

00003 00010 : 55A PyCallFunction "UUID" "UUID"  => A
00003 0001A : 190 stop

so the problem is at runtime (RUN and VLIST) ;

I do not identify any changes into uv/bin.

I try to basic/RUN/VLIST as root, I get the same trouble.

I've no idea what can be the trouble.

.... :-( 
 

Mike Rajkowski's profile image
ROCKETEER Mike Rajkowski
Manu,
Have you tested the Python code by itself on the machine with the issue?
 
If it is working, compare the environment when you enter Python first, and when you 
enter UniVerse first.
 
Check the Python path:
import sys
sys.path
 
Also, in the test where you go into Python first, check that you are running the
Python provided by UniVerse:
sys.executable
 
---
 
If it also fails when you go into python first, look at modules installed, from the 
OS command line.
 
pip list
 
Also, check if there is a different version of the uuid.dll on the system.
 
<sidenote>I would not recomend doing nested statements in an EQUATE, if the inner 
function call raises an exception, you have no way to catch it and take another action.
I would recomend that you write your a python function to marshal the attribute
to a string and return it, instead of requiring a 2nd call from UniVerse</sidenote>  
 
 
Neil Morris's profile image
ROCKETEER Neil Morris

Hi Manu,

Thanks for the latest testing results. Very interesting that the compiled code behaves just fine on a different system. But the RUN and VLIST commands are apparently interpreting that same object code differently. The VLIST output indicates an extra argument of '2' is being used and that shifts the correct arguments. Are you able to see the pcode using RAID with the 'I' or 'X' command? If so, does it show the same as VLIST? 

Mike offered some comments related to checking your runtime environment. I'm not sure if RUN or VLIST does anything different when encountering a Python function rather than a standard function. If not, then unclear how/why VLIST would treat the same object differently on 2 different systems. Still thinking of possibilities.

Neil

Manu Fernandes's profile image
PARTNER Manu Fernandes
hello Mike,

thank you 
for  your help.
Yes, the py code run correctly from outside or inside uv.

but you are right, when I run uv/python the sys.executable is not bin/uv but /usr/local/bin/python3 

the box have 4 distributions of python 2.6, 3.4.10, 3.6.4 and uv's 3.4.1 

Is there a venv to be defined when/before I start uv ? 

many thanks 

manu

Manu Fernandes's profile image
PARTNER Manu Fernandes

Hi Neil,

about RAID , yes, it execute like RUN & VLIST, here is the capture : 

>RAID BP TEST                                                      
 TEST:   1: PRINT DATE()                                           
:: H                                                               
Main Program                                                       
Compiler version: 11.3.0.0                                         
Machine type    : 0x1                                              
Object Size     : 0x2A                                             
Constants       : 6                                                
Subroutine args : 0                                                
Local Variables : 1                                                
Unnamed Common  : 0                                                
Named Commed Seg: 0                                                
:: I                                                               
   4: 130 printcrlf       $R0                                      
:: I                                                               
20492                                                              
   A:  F8 move            1  => A                                  
:: X                                                   
  10: 55A PyCallFunction  2 "uuid"  => "uuid4"         
:: I                                                               
  10: 55A PyCallFunction  2 "uuid"  => "uuid4"                     
:: I                                                               
Abnormal termination of UniVerse.                                  
Fault type is 11.  Layer type is BASIC run machine.                
Fault occurred in BASIC program TEST at address 10.                
Segmentation fault (core dumped)                                   

Mike Rajkowski's profile image
ROCKETEER Mike Rajkowski

Manu,

Since the systems where it works are the same OS and UniVerse Version, I am thinking there may be a difference in configuration, or what has been loaded on the system.

You can use the exact path to the UniVerse version of Python, to see if the module has any issue.

I expect that one of the other Python Versions on the system put some paths into the PATH environment variable.

Compare the PATH(s) from the system that is working to the system that fails.

Also check for a PYTHONPATH environment variable.

Neil Morris's profile image
ROCKETEER Neil Morris

Hi Manu,

If you have two Linux systems running the same version of UV where one works and the other fails, can you try the following and attach the results?

# strace -o bad.out uvsh "VLIST BP TEST"    on the system which fails

# strace -o good.out uvsh "VLIST BP TEST"   on the system which works

Thanks,

Neil

Neil Morris's profile image
ROCKETEER Neil Morris

Hi Manu,

A slight update to my last post. The 'strace' command should include the "-f" option. For example:

# strace -o bad.out -f uvsh "VLIST BP TEST"

Thanks,

Neil

Manu Fernandes's profile image
PARTNER Manu Fernandes

I join the bad.out.txt file (uv 11.3.0)  I do not have other box with the same release/linux. 

regards.

manu

Attachment  View in library
bad.out.txt 193 KB
Neil Morris's profile image
ROCKETEER Neil Morris

Hi Manu,

I ran the test on another system internally. The strace shows the same behavior of the value '2' being applied as the first argument. 

The output from your system is as follows:

6276  write(1, " ", 1)                  = 1
6276  write(1, "PyCallFunction ", 15)   = 15
6276  write(1, "2", 1)                  = 1
6276  write(1, " ", 1)                  = 1

On an internal system, the result are as follows:

12898 write(1, " ", 1)                  = 1
12898 write(1, "PyCallFunction ", 15)   = 15
12898 write(1, "\"UUID\"", 6)           = 6
12898 write(1, " ", 1)                  = 1

I don't know where the '2' is coming from or why it just started happening. I know you checked for changes in uvhome, but perhaps a reinstall of UV?

Thanks,

Neil