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

Racket 8.2 on Mac Monterey Beta - Can't save files #4010

Closed
cwhatley opened this issue Oct 1, 2021 · 19 comments
Closed

Racket 8.2 on Mac Monterey Beta - Can't save files #4010

cwhatley opened this issue Oct 1, 2021 · 19 comments

Comments

@cwhatley
Copy link

cwhatley commented Oct 1, 2021

What version of Racket are you using?
e.g., 8.2 [cs]

What program did you run?
Open DrRacket and create a new file out of the Downloads folder.
Make small change
Try to save

Error message: "The save file operation failed to connect to the open and save panel service."

What should have happened?

The open panel should have opened successfully and allowed me to proceed with saving the file.

If you got an error message, please include it here.
image

Please include any other relevant details
e.g., the operating system used or how you are running the code.

Mac Monterey Beta 7 on intel (final version releasing soon)

@sorawee
Copy link
Collaborator

sorawee commented Oct 1, 2021

On Mac, there are settings in the Privacy tab like "Full Disk Access" and "Files and Folders". I wonder if adding DrRacket to the list will fix the problem.

@cwhatley
Copy link
Author

cwhatley commented Oct 1, 2021

Unfortunately not. Tried that already.

@cwhatley
Copy link
Author

cwhatley commented Oct 1, 2021

Note: FYI, If you open an existing file from the Finder, you can save that file, but any new file fails.

@cwhatley
Copy link
Author

cwhatley commented Oct 1, 2021

Here are some relevant from the console when I try to save a document:


default	22:17:14.872180-0400	runningboardd	Acquiring assertion targeting [xpcservice<com.apple.appkit.xpc.openAndSavePanelService([app<application.org.racket-lang.DrRacket.156882198.156882204(501)>:15467])(501)>:15514:15514] from originator [xpcservice<com.apple.appkit.xpc.openAndSavePanelService([app<application.org.racket-lang.DrRacket.156882198.156882204(501)>:15467])(501)>:15514:15514] with description <RBSAssertionDescriptor| "AppNap adapter assertion" ID:187-15514-21799 target:15514 attributes:[
	<RBSAcquisitionCompletionAttribute| policy:AfterApplication>,
	<RBSDomainAttribute| domain:"com.apple.appnap" name:"Enable" sourceEnvironment:"(null)">,
	<RBSDomainAttribute| domain:"com.apple.appnap" name:"Inactive" sourceEnvironment:"(null)">,
	<RBSDomainAttribute| domain:"com.apple.appnap" name:"PreventDiskThrottle" sourceEnvironment:"(null)">,
	<RBSDomainAttribute| domain:"com.apple.appnap" name:"PreventSuppressedCPU" sourceEnvironment:"(null)">,
	<RBSDomainAttribute| domain:"com.apple.appnap" name:"PreventLowPriorirtyCPU" sourceEnvironment:"(null)">,
	<RBSDomainAttribute| domain:"com.apple<…>
default	22:17:14.872340-0400	runningboardd	Assertion 187-15514-21799 (target:[xpcservice<com.apple.appkit.xpc.openAndSavePanelService([app<application.org.racket-lang.DrRacket.156882198.156882204(501)>:15467])(501)>:15514:15514]) will be created as active
default	22:17:14.872766-0400	runningboardd	Calculated state for xpcservice<com.apple.appkit.xpc.openAndSavePanelService([app<application.org.racket-lang.DrRacket.156882198.156882204(501)>:15467])(501)>:15514: running-active (role: UserInteractiveNonFocal)
default	22:17:14.872773-0400	runningboardd	[xpcservice<com.apple.appkit.xpc.openAndSavePanelService([app<application.org.racket-lang.DrRacket.156882198.156882204(501)>:15467])(501)>:15514:15514] Ignoring jetsam update because this process is not memory-managed
default	22:17:14.872797-0400	runningboardd	[xpcservice<com.apple.appkit.xpc.openAndSavePanelService([app<application.org.racket-lang.DrRacket.156882198.156882204(501)>:15467])(501)>:15514:15514] Ignoring suspend because this process is not lifecycle managed
default	22:17:14.872852-0400	runningboardd	[xpcservice<com.apple.appkit.xpc.openAndSavePanelService([app<application.org.racket-lang.DrRacket.156882198.156882204(501)>:15467])(501)>:15514:15514] Ignoring GPU update because this process is not GPU managed
default	22:17:14.872987-0400	runningboardd	[xpcservice<com.apple.appkit.xpc.openAndSavePanelService([app<application.org.racket-lang.DrRacket.156882198.156882204(501)>:15467])(501)>:15514:15514] Set AppNap state: <RBMutableProcessAppNapState|0x7f79ad724850 enabled:Y active:N socket:N disk:N priority:N cpu:N timer:Tier0>
default	22:17:14.873603-0400	runningboardd	Invalidating assertion 187-15514-21726 (target:[xpcservice<com.apple.appkit.xpc.openAndSavePanelService([app<application.org.racket-lang.DrRacket.156882198.156882204(501)>:15467])(501)>:15514:15514]) from originator [xpcservice<com.apple.appkit.xpc.openAndSavePanelService([app<application.org.racket-lang.DrRacket.156882198.156882204(501)>:15467])(501)>:15514:15514]
default	22:17:14.874588-0400	com.apple.appkit.xpc.openAndSavePanelService	Requested resource was not within the code object: /System/Library/Frameworks/AppKit.framework/Resources/Base.lproj/NSNavPanelAppCentricContentView.nib, /Applications/Racket v8.2/DrRacket.app/Contents
default	22:17:14.891243-0400	com.apple.appkit.xpc.openAndSavePanelService	Requested resource was not within the code object: /System/Library/PrivateFrameworks/FinderKit.framework/Resources/Base.lproj/TagEditorView.nib, /Applications/Racket v8.2/DrRacket.app/Contents
default	22:17:14.904468-0400	com.apple.appkit.xpc.openAndSavePanelService	Requested resource was not within the code object: /System/Library/PrivateFrameworks/FinderKit.framework/Resources/Base.lproj/FinderView.nib, /Applications/Racket v8.2/DrRacket.app/Contents
default	22:17:14.910546-0400	com.apple.appkit.xpc.openAndSavePanelService	Requested resource was not within the code object: /System/Library/PrivateFrameworks/FinderKit.framework/Resources/Base.lproj/BrowserOverlayStackView.nib, /Applications/Racket v8.2/DrRacket.app/Contents
default	22:17:14.953445-0400	com.apple.appkit.xpc.openAndSavePanelService	Requested resource was not within the code object: /System/Library/PrivateFrameworks/FinderKit.framework/Resources/Base.lproj/SidebarView.nib, /Applications/Racket v8.2/DrRacket.app/Contents
default	22:17:14.964441-0400	com.apple.appkit.xpc.openAndSavePanelService	Requested resource was not within the code object: /System/Library/PrivateFrameworks/FinderKit.framework/Resources/Base.lproj/ColumnView.nib, /Applications/Racket v8.2/DrRacket.app/Contents
default	22:17:14.986776-0400	com.apple.appkit.xpc.openAndSavePanelService	Requested resource was not within the code object: /System/Library/PrivateFrameworks/FinderKit.framework/Resources/Base.lproj/ArrangeByMenu.nib, /Applications/Racket v8.2/DrRacket.app/Contents
default	22:17:15.999543-0400	runningboardd	[xpcservice<com.apple.appkit.xpc.openAndSavePanelService([app<application.org.racket-lang.DrRacket.156882198.156882204(501)>:15467])(501)>:15514:15514] Ignoring jetsam update because this process is not memory-managed
default	22:17:15.999643-0400	runningboardd	Calculated state for xpcservice<com.apple.appkit.xpc.openAndSavePanelService([app<application.org.racket-lang.DrRacket.156882198.156882204(501)>:15467])(501)>:15514: running-active (role: UserInteractiveNonFocal)
default	22:17:15.999655-0400	runningboardd	[xpcservice<com.apple.appkit.xpc.openAndSavePanelService([app<application.org.racket-lang.DrRacket.156882198.156882204(501)>:15467])(501)>:15514:15514] Ignoring suspend because this process is not lifecycle managed
default	22:17:15.000181-0400	runningboardd	[xpcservice<com.apple.appkit.xpc.openAndSavePanelService([app<application.org.racket-lang.DrRacket.156882198.156882204(501)>:15467])(501)>:15514:15514] Ignoring GPU update because this process is not GPU managed
default	22:17:15.077493-0400	DrRacket	*** Assertion failure in -[NSSavePanel beginServicePanel:asyncExHandler:], NSVBOpenAndSavePanels.m:1907
error	22:17:15.077567-0400	DrRacket	-[NSSavePanel beginServicePanel:asyncExHandler:] : an exception occurred during attempt to advance an Open/Save panel to run phase!
error	22:17:15.077595-0400	DrRacket	An exception occured inside beginServicePanel:asyncExHandler: -- <NSSavePanel: 0x7fe506d2d290> is attempting to advance this Open/Save panel to run phase while another self.advanceToRunPhaseCompletionHandler is in waiting for a previous attempt. An Open/Save panel cannot start to advance more than once.
default	22:17:15.078031-0400	DrRacket	-[NSSavePanel beginSheetModalForWindow:completionHandler:]_block_invoke caught non-fatal NSInternalInconsistencyException '<NSSavePanel: 0x7fe506d2d290> is attempting to advance this Open/Save panel to run phase while another self.advanceToRunPhaseCompletionHandler is in waiting for a previous attempt. An Open/Save panel cannot start to advance more than once.' with user dictionary {
    NSAssertFile = "NSVBOpenAndSavePanels.m";
    NSAssertLine = 1907;
} and backtrace (
	0   CoreFoundation                      0x00007ff8145fff5b __exceptionPreprocess + 242
	1   libobjc.A.dylib                     0x00007ff814360b9d objc_exception_throw + 48
	2   Foundation                          0x00007ff8154b2983 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 267
	3   AppKit                              0x00007ff8179ab061 -[NSSavePanel beginServicePanel:asyncExHandler:] + 475
	4   AppKit                              0x00007ff8179ac2de -[NSSavePanel runModal] + 297
	5   ???
default	22:17:15.078561-0400	DrRacket	Requested resource was not within the code object: /System/Library/Frameworks/AppKit.framework/Resources/NSAlertPanelVertical.nib, /Applications/Racket v8.2/DrRacket.app/Contents
default	22:17:15.078696-0400	DrRacket	MacOS error: -50
default	22:17:15.081132-0400	DrRacket	Ignoring nib not in main bundle: <private>, <private> v<private>
default	22:17:15.276245-0400	runningboardd	Acquiring assertion targeting [xpcservice<com.apple.appkit.xpc.openAndSavePanelService([app<application.org.racket-lang.DrRacket.156882198.156882204(501)>:15467])(501)>:15514:15514] from originator [daemon<com.apple.WindowServer(88)>:164] with description <RBSAssertionDescriptor| "AppDrawing" ID:187-164-21800 target:15514 attributes:[
	<RBSDomainAttribute| domain:"com.apple.appnap" name:"AppDrawing" sourceEnvironment:"(null)">,
	<RBSAcquisitionCompletionAttribute| policy:AfterApplication>
	]>

@cwhatley
Copy link
Author

I've run into this now on two different machines running the beta. I can imagine that quite a few freshman CS majors are going to update their macs in a couple of weeks and be in a real pickle.

@rfindler
Copy link
Member

If you exit drracket, run racket, and evaluate these two, then exit racket and start up drracket again, can you save (with an uglier dialog box)?

% racket
Welcome to Racket v8.3.0.1 [cs].
> (require framework)
> (preferences:set 'framework:file-dialogs 'common)

@cwhatley
Copy link
Author

Thanks. That works!

rfindler added a commit to racket/string-constants that referenced this issue Oct 12, 2021
…c dialogs for save and open on windows and mac os

related to racket/racket#4010
rfindler added a commit to racket/string-constants that referenced this issue Oct 12, 2021
…c dialogs for save and open on windows and mac os

related to racket/racket#4010

(cherry picked from commit 1e55515)
rfindler added a commit to racket/gui that referenced this issue Oct 12, 2021
@rfindler
Copy link
Member

I've added a preference to the dialog box so folks can make this switch a bit more simply and I'm optimistic we'll get it included in the release.

@samth
Copy link
Sponsor Member

samth commented Oct 12, 2021

Should we change the default here so that people don't have to look this up and then change a preference? Could we change the default just for the new macOS version?

@rfindler
Copy link
Member

There's this that we might use, but I'm not sure how to get the right number for the beta (I don't have it).

@cwhatley
Copy link
Author

The current beta has NSAppKitVersionNumber as 2109. Anything >= to that should be fine.

mflatt pushed a commit to racket/gui that referenced this issue Oct 13, 2021
rfindler added a commit to racket/gui that referenced this issue Oct 14, 2021
related to racket/racket#4010

this affects only the release; hopefully we (or apple) will sort the problem out before the next release
@rfindler
Copy link
Member

After some offline discussion with @mflatt (inspired by @samth 's suggestion and thanks to @cwhatley 's info) I've pushed a change that affects only the release that will make the dialogs default to the racket-implemented ones on the monterey beta. Hopefully that'll be good enough.

@sspocketgalaxy
Copy link

@rfindler I also noticed today after upgrading to Monterey that the get-file and get-directory create this for the error dialog
Screen Shot 2021-10-26 at 2 30 50 PM

I'm assuming your patch is to handle all file system dialogs? Also is that the permanent solution or just temporary until someone can investigate what changes need to happen to get native dialogs back?

@rfindler
Copy link
Member

rfindler commented Oct 27, 2021

The current situation is that a new preference allows you to use racket/gui-based get and put file dialogs (you can find a preference for this in the "General" section of the preferences dialog: "Use platform-specific file dialogs"). The preference's default value used to mean "use the platform's dialogs" but in a recent change it was changed to "use the platform's dialogs, except on a particular beta of monterey and newer, where the racket/gui-based dialogs should be used instead".

What this means, however, is that people who started DrRacket on an older version and then update to the newer version need to go manually check this check box in order to avoid this bad behavior.

@rfindler
Copy link
Member

Oh, I should say that the current situation described above applies to the release candidate builds, not to the git head build or the snapshot builds.

@sspocketgalaxy
Copy link

I see - thanks for the intel and the fix. I wasn't sure how this worked as I'm new to using Racket.

@rfindler
Copy link
Member

Hopefully we'll get it into a better state before the release actually goes out! :)

@eddierucker
Copy link

I am running the racket version 8.3.0.5 [cs] on a Mac Mini (M1) with Monterey. In the following code:

`#lang racket/gui

(define frame (instantiate frame% ("Test")
(width 200)
(height 200)))

(define button (instantiate button% ("Open" frame)
(callback (lambda (c e)
(writeln (get-file "Open" frame))))))

(send frame show #t)
`

I get the same error as cwhatley. Strange, but, (get-file "Open") works but (get-file "Open" frame) will not. If it is any help, I get the same errors using askopenfilename() in tkinter (Python 3.10) .

@mflatt
Copy link
Member

mflatt commented Oct 28, 2021

The latest snapshot includes a change (to be included in v8.3) that avoids that crash: https://www.cs.utah.edu/plt/snapshots/. That workaround is basically what @eddierucker observed: don't create a file dialog with a parent frame.

The next snapshot will include a more complex workaround that allows a file dialog to have a parent frame, but it's complicated enough to delay inclusion in a release.

@mflatt mflatt closed this as completed Jan 3, 2022
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

7 participants