capfredf
2022-5-10 14:33:40

@mflatt I am troubleshooting this issue using errortrace, but I ran into another problem with it: abuild@HMSBeagle:~/rpmbuild/BUILDROOT/racket-8.5-0.x86_64/usr/share/racket/pkgs/draw-lib/racket/draw/private> racket -l errortrace -t ../../../../drracket/gui-debugger/debug-tool.rkt identifier used out of context: #<syntax:/home/abuild/rpmbuild/BUILDROOT/racket-8.5-0.x86_64/usr/share/racket/pkgs/gui-lib/framework/private/text-port.rkt:83:17 committer?>


capfredf
2022-5-10 14:34:37

bascially I am trying to figure out why the cairo surface is false


mflatt
2022-5-10 15:35:30

This appears to be a problem with expand and #%variable-reference and rename transformer.


mflatt
2022-5-10 15:35:44

I’ll look at fixing the expander


capfredf
2022-5-10 15:36:04

thanks


mflatt
2022-5-10 16:59:56

I’ve pushed that repair


tgbugs
2022-5-10 17:30:47

Is there a reason why modifying a gui canvas from multiple threads would cause the program to quit/crash without an error on windows but not macos/linux?


tgbugs
2022-5-10 17:34:02

or maybe running a thread (even one that does nothing)?


soegaard2
2022-5-10 17:39:20

@tgbugs Section “1.6.2. Eventspaces and Threads” has the following to say: > Windowing functions and methods from https://docs.racket-lang.org/gui/index.html\|racket/gui/base can be called in any thread, but beware of creating race conditions among the threads or with the handler thread. Graphical objects are thread-safe, but callbacks or other event handlers might see changing object states if graphical elements are manipulated in multiple threads. Editor classes have more significant thread constraints; see <https://docs.racket-lang.org/gui/editor-overview.html#%28part._editorthreads%29|Editors and Threads>.


soegaard2
2022-5-10 17:40:05

If you are seeing a crash on Windows, it might a bug in racket/gui ?


tgbugs
2022-5-10 17:41:28

@soegaard2 thanks, it actually seems like it isn’t threads at all


tgbugs
2022-5-10 17:42:32

not entirely sure what it is yet, but I was able to eliminate the thread and still get the behavior, which is a relief


laurent.orseau
2022-5-10 17:46:19

Try to eliminate Windows :stuck_out_tongue:


dianne.eramo
2022-5-10 17:48:26

@dianne.eramo has joined the channel


tgbugs
2022-5-10 17:48:45

@laurent.orseau if only


tgbugs
2022-5-10 17:49:22

Ok, so … is there a reason why calling directory-exists? or file-exists on a symlink on windows would cause a gui program to crash !?


tgbugs
2022-5-10 17:49:30

time to go dig in the code


laurent.orseau
2022-5-10 17:49:49

No exception raised?


tgbugs
2022-5-10 17:49:59

none


laurent.orseau
2022-5-10 17:50:10

Did you start the program from the command line?


tgbugs
2022-5-10 17:51:15

@laurent.orseau happens from cli and running a gui exe


laurent.orseau
2022-5-10 17:52:07

ok. Make sure you run from the cli, because if an exception is raised maybe you won’t see it (it should open a terminal window, but if the program terminates maybe the window will be close automatically depending on your Settings I think)


tgbugs
2022-5-10 17:52:57

here is a one line repro


tgbugs
2022-5-10 17:53:41

open racket from a terminal and run: (file-exists? "C:\\path\\to\\symlink")


tgbugs
2022-5-10 17:53:50

and racket will crash


laurent.orseau
2022-5-10 17:54:33

That certainly sounds like a bug


tgbugs
2022-5-10 17:58:05

I’m still not 100% on that repro, it does it with some links but not others


tgbugs
2022-5-10 18:03:20

AH HA


tgbugs
2022-5-10 18:04:30

the links that fail are created by python, not mklink, and they are relative links “relative/path” instead of the fully resolved links that mklink creates “C:/relative/path”


tgbugs
2022-5-10 18:17:53

but wait, there’s more! I think that the directory link has to be missing a trailing slash


tgbugs
2022-5-10 18:19:00

which racket cannot create by itself, but apparently python can


tgbugs
2022-5-10 18:24:51

nope, still some missing factor


tgbugs
2022-5-10 18:58:59

length of the name of the symlink target folder


laurent.orseau
2022-5-10 19:06:51

If it’s a prime number it crashes?


tgbugs
2022-5-10 19:17:27

haha if only, no, if it is longer than 60 chars


tgbugs
2022-5-10 19:17:32

submitting a bug now


laurent.orseau
2022-5-10 19:23:25

Glad you figured out the problem at least



tgbugs
2022-5-10 19:28:27

I think I have a workaround which involves resolving the path and then using build-path until the underlying issue is resolved.


tgbugs
2022-5-10 19:35:26

er … not quite right on the numbers, it is total path length


tgbugs
2022-5-10 19:35:29

updating


laurent.orseau
2022-5-10 19:45:54

Maybe mention it in the Issue, this may help resolve it, or provide a workaround to others in the meantime?


tgbugs
2022-5-10 19:47:12

yep will add


tgbugs
2022-5-10 19:47:39

the magic number is 127 -> 128 chars, which is more like what I would expect for something like this, 60 seemed wrong


capfredf
2022-5-10 20:24:22

@mflatt is it possible to build a full racket in an environment where git_init_check returns false?


mflatt
2022-5-10 20:29:20

gtk_init_check? Yes, I’m pretty sure we build that way often — such as every snapshot build, which is on a Linux machine with no X display and without using something like xvfb-run.


mflatt
2022-5-10 20:30:03

Unless I misunderstand what you mean, this constraint is why documentation is not allowed to depend on racket/gui for rendering.


capfredf
2022-5-10 20:38:02

that was my experience too.


capfredf
2022-5-10 20:39:13

But if I comment this expression https://github.com/racket/drracket/blob/master/drracket/gui-debugger/debug-tool.rkt#L45 and the export expression above and I load this module,


capfredf
2022-5-10 20:39:39

I get the gtk initialization failure


capfredf
2022-5-10 20:40:36

if I do nothing and just simply load this module, I get an error similar to the one in the main post


capfredf
2022-5-10 20:41:40

what’s the magic behind all this?


mflatt
2022-5-10 21:11:07

I’m not sure I understand the question. Compiling code is not the same thing as running it, and there’s no problem compiling a module that has (require racket/gui). There would be a problem compiling a module that has (require (for-syntax racket/gui)) or rendering a document that performs a (require racket/gui).


mflatt
2022-5-10 21:13:01

I think some modules in images use racket/draw at expansion time (so, compile time). It would make sense that compilation would fail if something goes wrong in those libraries. Maybe the particular expansion-time code is triggered only when an identifier is referenced, and that would explain why the error goes away when you comment out a reference — but that’s just a guess.


capfredf
2022-5-10 21:25:45

I wasn’t clear. By “load”, what I meant was simply racket debug-tool.rkt or (require "debug-tool.rkt") .


mflatt
2022-5-10 21:29:04

I understood that much. Merely loading the module file with racket -f debug-tool.rkt would compile and declare the module and not run it. I expect you’d get the drawing-context error when merely loading, instead of the X display error.


capfredf
2022-5-10 21:31:30

Indeed, I get the drawing context error when I compile the module


capfredf
2022-5-10 21:32:24

Thanks, your comments clarify a lot of things


capfredf
2022-5-11 02:28:54

My further investigation shows: https://github.com/racket/images/blob/master/images-lib/images/icons/symbol.rkt#L70 the result h is very large, 1134930 but w is 20


capfredf
2022-5-11 02:30:34

the arguments str and font are quite normal as well


capfredf
2022-5-11 02:35:48

It seems that because of the unusually large height, the drawing context is not okay (i.e. (send dc ok?) =&gt; #f) . Calling draw-text on a not-okay drawing context raises the error


capfredf
2022-5-11 02:37:13

The underlying problem seems to relate to pango (in the method do-text of dc%, but I haven’t figured it out yet.


capfredf
2022-5-11 03:12:35

capfredf
2022-5-11 03:13:08

or the initialization of layout


haoxianhan
2022-5-11 06:31:44

@haoxianhan has joined the channel