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

In Python 3 and Windows environment, the redoLayout method seems to cause Python to crash. #3624

Open
RichardFreedman opened this issue Mar 12, 2024 · 4 comments

Comments

@RichardFreedman
Copy link

RichardFreedman commented Mar 12, 2024

Below is code that will take in MEI, then render just a selection of measures (as for an incipit or example). It works fine in Mac and in Google Collab. But in a Windows environment the redoLayout() method will cause the kernel to crash. If we leave this method out of the code--no problem. But in that case we render the entire piece, and not the selection.

import urllib.request
import verovio
from IPython.display import SVG, HTML

# file to import:
url = 'https://crimproject.org/mei/CRIM_Model_0008.mei'

# Open the URL and read the content
with urllib.request.urlopen(url) as response:
    fetched_mei_string = response.read().decode('utf-8')

tk = verovio.toolkit()
tk.loadData(fetched_mei_string)
tk.setScale(30)
tk.setOptions({"pageHeight":  1200, 
               "pageWidth":  1500    
               })

mr = str(1) + "-" + str(2)
mdict = {'measureRange': mr}

tk.select(mdict)
tk.redoLayout()

count = tk.getPageCount()
for c in range(1, count + 1):
    music = tk.renderToSVG(c)
    display(SVG(music))
@RichardFreedman
Copy link
Author

After further experimentation, we notice that the problem does NOT occur with Verovio 3.15.0. We have not yet tested with versions between 3.15 and the current one. But perhaps this is a clue.

@bigorenski
Copy link

bigorenski commented Mar 16, 2024

Same happens on armv7 android

Just compiled 3.15 for armv7 and can confirm it works correctly

Details of the crash (v4.1.0):

03-16 01:20:54.790 32250 32250 F DEBUG : Revision: '0'
03-16 01:20:54.790 32250 32250 F DEBUG : ABI: 'arm'
03-16 01:20:54.790 32250 32250 F DEBUG : Timestamp: 2024-03-16 01:20:54.164763249-0300
03-16 01:20:54.790 32250 32250 F DEBUG : Process uptime: 0s
03-16 01:20:54.790 32250 32250 F DEBUG : Cmdline: com.YourCompany.MyProject3
03-16 01:20:54.790 32250 32250 F DEBUG : pid: 32105, tid: 32134, name: GameThread >>> com.YourCompany.MyProject3 <<<
03-16 01:20:54.790 32250 32250 F DEBUG : uid: 10548
03-16 01:20:54.790 32250 32250 F DEBUG : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xe0
03-16 01:20:54.790 32250 32250 F DEBUG : Cause: null pointer dereference
03-16 01:20:54.790 32250 32250 F DEBUG : r0 a7746fbc r1 00000000 r2 fffffffe r3 00000080
03-16 01:20:54.790 32250 32250 F DEBUG : r4 a7746e00 r5 00000000 r6 ffffd8eb r7 bea4f670
03-16 01:20:54.790 32250 32250 F DEBUG : r8 eaa94138 r9 ffffd8eb r10 bea4f7d8 r11 00000000
03-16 01:20:54.791 32250 32250 F DEBUG : ip bbcec880 sp bea4f620 lr bb72d52b pc bb72d530
03-16 01:20:54.791 32250 32250 F DEBUG : backtrace:
03-16 01:20:54.791 32250 32250 F DEBUG : #00 pc 003d8530 /data/app/~~mthqxq3l6mPKBXIS0LzhEQ==/com.YourCompany.MyProject3-g_3T8Vg_0yT5rW3P4f_51w==/lib/arm/libverovio.so (vrv::CalcAlignmentPitchPosFunctor::VisitLayerElement(vrv::LayerElement*)+84) (BuildId: dce7600b15847b418c06acc567fd2cfe17bfc14e)
03-16 01:20:54.791 32250 32250 F DEBUG : #1 pc 0057093d /data/app/~~mthqxq3l6mPKBXIS0LzhEQ==/com.YourCompany.MyProject3-g_3T8Vg_0yT5rW3P4f_51w==/lib/arm/libverovio.so (vrv::Object::Process(vrv::Functor&, int, bool)+36) (BuildId: dce7600b15847b418c06acc567fd2cfe17bfc14e)
03-16 01:20:54.791 32250 32250 F DEBUG : #2 pc 005709a3 /data/app/~~mthqxq3l6mPKBXIS0LzhEQ==/com.YourCompany.MyProject3-g_3T8Vg_0yT5rW3P4f_51w==/lib/arm/libverovio.so (vrv::Object::Process(vrv::Functor&, int, bool)+138) (BuildId: dce7600b15847b418c06acc567fd2cfe17bfc14e)
03-16 01:20:54.791 32250 32250 F DEBUG : #3 pc 005709a3 /data/app/~~mthqxq3l6mPKBXIS0LzhEQ==/com.YourCompany.MyProject3-g_3T8Vg_0yT5rW3P4f_51w==/lib/arm/libverovio.so (vrv::Object::Process(vrv::Functor&, int, bool)+138) (BuildId: dce7600b15847b418c06acc567fd2cfe17bfc14e)
03-16 01:20:54.791 32250 32250 F DEBUG : #4 pc 005709a3 /data/app/~~mthqxq3l6mPKBXIS0LzhEQ==/com.YourCompany.MyProject3-g_3T8Vg_0yT5rW3P4f_51w==/lib/arm/libverovio.so (vrv::Object::Process(vrv::Functor&, int, bool)+138) (BuildId: dce7600b15847b418c06acc567fd2cfe17bfc14e)
03-16 01:20:54.791 32250 32250 F DEBUG : #5 pc 005709a3 /data/app/~~mthqxq3l6mPKBXIS0LzhEQ==/com.YourCompany.MyProject3-g_3T8Vg_0yT5rW3P4f_51w==/lib/arm/libverovio.so (vrv::Object::Process(vrv::Functor&, int, bool)+138) (BuildId: dce7600b15847b418c06acc567fd2cfe17bfc14e)
03-16 01:20:54.791 32250 32250 F DEBUG : #6 pc 005709a3 /data/app/~~mthqxq3l6mPKBXIS0LzhEQ==/com.YourCompany.MyProject3-g_3T8Vg_0yT5rW3P4f_51w==/lib/arm/libverovio.so (vrv::Object::Process(vrv::Functor&, int, bool)+138) (BuildId: dce7600b15847b418c06acc567fd2cfe17bfc14e)
03-16 01:20:54.791 32250 32250 F DEBUG : #7 pc 003d8c7f /data/app/~~mthqxq3l6mPKBXIS0LzhEQ==/com.YourCompany.MyProject3-g_3T8Vg_0yT5rW3P4f_51w==/lib/arm/libverovio.so (non-virtual thunk to vrv::CalcAlignmentPitchPosFunctor::VisitScore(vrv::Score*)+24) (BuildId: dce7600b15847b418c06acc567fd2cfe17bfc14e)
03-16 01:20:54.791 32250 32250 F DEBUG : #8 pc 0057093d /data/app/~~mthqxq3l6mPKBXIS0LzhEQ==/com.YourCompany.MyProject3-g_3T8Vg_0yT5rW3P4f_51w==/lib/arm/libverovio.so (vrv::Object::Process(vrv::Functor&, int, bool)+36) (BuildId: dce7600b15847b418c06acc567fd2cfe17bfc14e)
03-16 01:20:54.791 32250 32250 F DEBUG : #9 pc 005709a3 /data/app/~~mthqxq3l6mPKBXIS0LzhEQ==/com.YourCompany.MyProject3-g_3T8Vg_0yT5rW3P4f_51w==/lib/arm/libverovio.so (vrv::Object::Process(vrv::Functor&, int, bool)+138) (BuildId: dce7600b15847b418c06acc567fd2cfe17bfc14e)
03-16 01:20:54.791 32250 32250 F DEBUG : #10 pc 0059f6a9 /data/app/~~mthqxq3l6mPKBXIS0LzhEQ==/com.YourCompany.MyProject3-g_3T8Vg_0yT5rW3P4f_51w==/lib/arm/libverovio.so (vrv::Page::ResetAligners()+320) (BuildId: dce7600b15847b418c06acc567fd2cfe17bfc14e)
03-16 01:20:54.791 32250 32250 F DEBUG : #11 pc 0059e7f7 /data/app/~~mthqxq3l6mPKBXIS0LzhEQ==/com.YourCompany.MyProject3-g_3T8Vg_0yT5rW3P4f_51w==/lib/arm/libverovio.so (vrv::Page::LayOutHorizontally()+46) (BuildId: dce7600b15847b418c06acc567fd2cfe17bfc14e)
03-16 01:20:54.791 32250 32250 F DEBUG : #12 pc 003ede39 /data/app/~~mthqxq3l6mPKBXIS0LzhEQ==/com.YourCompany.MyProject3-g_3T8Vg_0yT5rW3P4f_51w==/lib/arm/libverovio.so (vrv::Doc::CastOffDocBase(bool, bool, bool)+220) (BuildId: dce7600b15847b418c06acc567fd2cfe17bfc14e)
03-16 01:20:54.791 32250 32250 F DEBUG : #13 pc 005d6fbd /data/app/~~mthqxq3l6mPKBXIS0LzhEQ==/com.YourCompany.MyProject3-g_3T8Vg_0yT5rW3P4f_51w==/lib/arm/libverovio.so (vrv::Toolkit::LoadData(std::__ndk1::basic_string<char, std::__ndk1::char_traits, std::__ndk1::allocator > const&)+2948) (BuildId: dce7600b15847b418c06acc567fd2cfe17bfc14e)
03-16 01:20:54.791 32250 32250 F DEBUG : #14 pc 005d59ad /data/app/~~mthqxq3l6mPKBXIS0LzhEQ==/com.YourCompany.MyProject3-g_3T8Vg_0yT5rW3P4f_51w==/lib/arm/libverovio.so (vrv::Toolkit::LoadFile(std::__ndk1::basic_string<char, std::__ndk1::char_traits, std::__ndk1::allocator > const&)+388) (BuildId: dce7600b15847b418c06acc567fd2cfe17bfc14e)

@lpugin
Copy link
Contributor

lpugin commented Mar 18, 2024

@bigorenski your log does not have a call to RedoLayout, does it?

@bigorenski
Copy link

bigorenski commented Mar 18, 2024

@bigorenski your log does not have a call to RedoLayout, does it?

It doesn't.

Same thing happens if I call tk->select before loading a file, or RedoLayout after loading a file, but I don't see the call in the logs. I couldn't understand why

The same code runs fine on 3.15

P.S: Everything called after vrv::Toolkit::LoadFile was called by the toolkit itself

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

3 participants