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

demo prima gives unexpected Ctrl-C message and error at end #51

Open
mohawk2 opened this issue Apr 4, 2023 · 10 comments
Open

demo prima gives unexpected Ctrl-C message and error at end #51

mohawk2 opened this issue Apr 4, 2023 · 10 comments

Comments

@mohawk2
Copy link
Member

mohawk2 commented Apr 4, 2023

@dk Do you have any idea what causes this? Latest PDL, in perldl:

pdl> demo prima
---- Code:
  # starting up the Prima GUI demo app
  PDL::Demos::Prima::run();
---- Output:
Use of uninitialized value $posn in numeric eq (==) at (LIB)/PDL/Demos/Prima.pm line 311, <DATA> line 224.
----

The "uninitialized value" is if I click "Next" on the last page, after which it changes to a "Finish" button. On clicking "Finish", I see:

pdl> Unknown error: time to exit the event loop at (LIB)/PDL/Demos/Prima.pm line 139, <DATA> line 224.
	...propagated at (LIB)PDL/Graphics/Prima/ReadLine.pm line 65, <DATA> line 224.

 exiting...
[then it shows the "demo" output again without the "prima" entry, then immediately:]
Ctrl-C detected
Compilation failed in require at (LIB)/PDL/Graphics/Prima.pm line 26.
BEGIN failed--compilation aborted at (LIB)/PDL/Graphics/Prima.pm line 26.
Compilation failed in require at (LIB)/PDL/Demos/Prima.pm line 5.
BEGIN failed--compilation aborted at (LIB)/PDL/Demos/Prima.pm line 5.
Compilation failed in require

To avoid doubt, I didn't press Ctrl-C.

@dk
Copy link
Contributor

dk commented Apr 5, 2023

Yes, looks like this was always there. This should fix it
patch.txt

@mohawk2
Copy link
Member Author

mohawk2 commented Apr 6, 2023

Thanks! Could you PR it?

dk added a commit to dk/PDL-Graphics-Prima that referenced this issue Apr 6, 2023
and add minor style fixes
mohawk2 added a commit that referenced this issue Apr 6, 2023
@mohawk2
Copy link
Member Author

mohawk2 commented Apr 6, 2023

Thanks! More strangeness:

pdl> p $$
366399
pdl> demo
Use:
[snip]
   demo pgplotOO    # PGPLOT OO interface
   demo prima       # Prima graphics
   demo transform   # Coordinate transformations (Req.: PGPLOT)
pdl> p $$
366399
pdl> q
Use:
[snip]
   demo pgplotOO    # PGPLOT OO interface
   demo transform   # Coordinate transformations (Req.: PGPLOT)
Ctrl-C detected
 at blib/script/perldl line 228.
	main::__ANON__[blib/script/perldl:229]("INT") called at (LIB)/x86_64-linux/Prima.pm line 59
	eval {...} called at (LIB)/x86_64-linux/Prima.pm line 59
	require Prima.pm called at (LIB)/PDL/Graphics/Prima.pm line 26
[snip]
pdl> p $$
366403

I believe this is because the P:G:Prima demo loads Prima, which initialises itself (at line 59 of Prima.pm), but is then not used. I don't consider it unreasonable for Prima to get itself ready for use on being loaded, and I could make P:G:Prima not load Prima itself, but instead change it so that its using libraries/scripts had to do so (in this case, making the demo do it when run). However, do you think Prima should handle this in a different way? Also I'm not clear why the signal handler (installed by perldl to handle Ctrl-C) is being called at all, and why that seems to fork the process. Might this be due to Prima's END needing to be a bit more careful?

Similar to the above happens when I run the demo and immediately use the window's "X" button to close it, then tell perldl to exit - it reports failing to load the demo, and has a different $$.

@dk
Copy link
Contributor

dk commented Apr 7, 2023

I'm not sure I understood the protocol, but at my best, I couldn't reproduce:

$ perldl
perlDL shell v1.357
 PDL comes with ABSOLUTELY NO WARRANTY. For details, see the file
 'COPYING' in the PDL distribution. This is free software and you
 are welcome to redistribute it under certain conditions, see
 the same file for details.
ReadLines, NiceSlice, MultiLines  enabled
Reading PDL/default.perldlrc...
Found docs database /usr/local/lib/x86_64-linux-gnu/perl/5.34.0/PDL/pdldoc.db
Type 'help' for online help
Type 'demo' for online demos
Loaded PDL v2.081 (supports bad values)

Note: AutoLoader not enabled ('use PDL::AutoLoader' recommended)

pdl> p $$
1919296
pdl> demo
Use:
   demo pdl         # general demo
   demo bad         # Bad-value demo (Optional: PGPLOT)
   demo cartography # Cartographic projections (Req.: PGPLOT)
   demo prima       # Prima graphics

pdl> p $$
1919296
pdl> demo
Use:
   demo pdl         # general demo
   demo bad         # Bad-value demo (Optional: PGPLOT)
   demo cartography # Cartographic projections (Req.: PGPLOT)
   demo prima       # Prima graphics

pdl> p $$
1919296
pdl> q
$

@dk
Copy link
Contributor

dk commented Apr 7, 2023

I also have another installation with demos pgplot, pgplot00, and transform - and again, nothing.

I wonder if this could be a mix-up of several module versions in your installation? The string "time to exit the event loop" is only found in the older versions of P:G:P...

@mohawk2
Copy link
Member Author

mohawk2 commented Apr 7, 2023

With:

  • Prima 1.68002
  • P:D:Prima git latest
  • P:G:Prima git latest
  • PDL git latest

On Ubuntu, I am running perldl, with demo and q, and seeing the same spurious "Ctrl-C" and new process.

I see your perldl shows PDL 2.081 (CPAN latest is 2.082). Could you try with these versions? Also, what OS are you on? (Though from that path I assume Linux)

Could you also try installing OpenGL and OpenGL::GLUT? If your demo list is the complete list (mine was cut down), that might have an influence. (Also, the demo 3d is kind of cool, though I am definitely biased!)

@dk
Copy link
Contributor

dk commented Apr 8, 2023

All right, tried on a fresh ubuntu and perl5.36:

(16:30)dk@hp build/PDL-2.082-0> perldl
perlDL shell v1.357
 PDL comes with ABSOLUTELY NO WARRANTY. For details, see the file
 'COPYING' in the PDL distribution. This is free software and you
 are welcome to redistribute it under certain conditions, see
 the same file for details.
ReadLines, NiceSlice, MultiLines  enabled
Reading PDL/default.perldlrc...
Found docs database /home/dk/perl5/perlbrew/perls/perl-5.36.0/lib/site_perl/5.36.0/x86_64-linux/PDL/pdldoc.db
Type 'help' for online help
Type 'demo' for online demos
Loaded PDL v2.082 (supports bad values)

Note: AutoLoader not enabled ('use PDL::AutoLoader' recommended)

pdl> p $$
377867
pdl> demo
Use:
   demo pdl         # general demo
   demo 3d          # 3d demo (requires TriD with OpenGL or Mesa)
   demo 3d2         # 3d demo, part 2. (Somewhat memory-intensive)
   demo 3dgal       # the 3D gallery: make cool images with 3-line scripts
   demo bad         # Bad-value demo (Optional: PGPLOT)
   demo cartography # Cartographic projections (Req.: PGPLOT)
   demo pgplot      # PGPLOT graphics output
   demo pgplotOO    # PGPLOT OO interface
   demo prima       # Prima graphics
   demo transform   # Coordinate transformations (Req.: PGPLOT)

pdl> p $$
377867
pdl> demo
Use:
   demo pdl         # general demo
   demo 3d          # 3d demo (requires TriD with OpenGL or Mesa)
   demo 3d2         # 3d demo, part 2. (Somewhat memory-intensive)
   demo 3dgal       # the 3D gallery: make cool images with 3-line scripts
   demo bad         # Bad-value demo (Optional: PGPLOT)
   demo cartography # Cartographic projections (Req.: PGPLOT)
   demo pgplot      # PGPLOT graphics output
   demo pgplotOO    # PGPLOT OO interface
   demo prima       # Prima graphics
   demo transform   # Coordinate transformations (Req.: PGPLOT)

pdl> 
pdl> q
dk@hp build/PDL-2.082-0> 

@mohawk2
Copy link
Member Author

mohawk2 commented Apr 8, 2023

Thank you. I shall have to dig into this and see what is going on locally!

@dk
Copy link
Contributor

dk commented Apr 8, 2023

Just in case, I ran this on the latest Prima snapshot from github

@mohawk2
Copy link
Member Author

mohawk2 commented Mar 29, 2024

This is something I forgot I'd reported here, and just created dk/Prima#114

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