-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
FIX: Address Mac CGO Crash #3590
Conversation
Warning Rate limit exceeded@leaanthony has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 25 minutes and 56 seconds before requesting another review. How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. WalkthroughThe changes address a CGO memory issue on macOS that caused application crashes when handling middleware responses. The Changes
Assessment against linked issues
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
Deploying wails with Cloudflare Pages
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Outside diff range and nitpick comments (2)
website/src/pages/changelog.mdx (2)
17-17
: Fix repeated word "issue".There is a repeated word "issue" in the changelog entry.
- Fixed CGO memory issue on Darwin by @leaanthony in [PR](https://github.com/wailsapp/wails/pull/3590) + Fixed CGO memory issue on Darwin by @leaanthony in [PR](https://github.com/wailsapp/wails/pull/3590)Tools
LanguageTool
[duplication] ~17-~17: Possible typo: you repeated a word
Context: ... vulnerabilities. ## [Unreleased] ### Fixed - Fixed CGO memory issue on Darwin by @leaantho...(ENGLISH_WORD_REPEAT_RULE)
18-18
: Fix repeated word "issue".There is a repeated word "issue" in the changelog entry.
- Fixed CGO memory issue on Darwin by @leaanthony in [PR](https://github.com/wailsapp/wails/pull/3590) + Fixed CGO memory issue on Darwin by @leaanthony in [PR](https://github.com/wailsapp/wails/pull/3590)
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- v2/pkg/assetserver/webview/responsewriter_darwin.go (1 hunks)
- website/src/pages/changelog.mdx (1 hunks)
Additional context used
LanguageTool
website/src/pages/changelog.mdx
[duplication] ~17-~17: Possible typo: you repeated a word
Context: ... vulnerabilities. ## [Unreleased] ### Fixed - Fixed CGO memory issue on Darwin by @leaantho...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~22-~22: Possible typo: you repeated a word
Context: ...pull/3590) ## v2.9.1 - 2024-06-18 ### Fixed - Fixed build issues on Linux for some glibc ve...(ENGLISH_WORD_REPEAT_RULE)
Additional comments not posted (4)
v2/pkg/assetserver/webview/responsewriter_darwin.go (4)
106-106
: Ensure thatcontentLen
is correctly calculated.The variable
contentLen
is set to 0 ifbuf
isnil
. This is correct, but ensure thatbuf
is properly checked before use.
112-112
: Verify the safety ofunsafe.Pointer
usage.Ensure that
buf
is not empty and that&buf[0]
is a valid pointer. This can prevent potential runtime panics.
114-115
: Handle potential errors fromURLSchemeTaskDidReceiveData
.The function
URLSchemeTaskDidReceiveData
returns a boolean indicating success or failure. Ensure proper error handling if it returnsfalse
.
118-119
: Handle potential errors fromURLSchemeTaskDidReceiveData
withnil
data.The function
URLSchemeTaskDidReceiveData
is called withnil
and0
ifcontentLen
is 0. Ensure proper error handling if it returnsfalse
.
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Quality Gate passedIssues Measures |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- v2/pkg/assetserver/webview/responsewriter_darwin.go (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- v2/pkg/assetserver/webview/responsewriter_darwin.go
// Create a C array to hold the data | ||
cBuf := C.malloc(C.size_t(contentLen)) | ||
if cBuf == nil { | ||
return 0, fmt.Errorf("memory allocation failed for %d bytes", contentLen) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fmt
import is missing so compile fails. Fixed this in my fork: v2-bugfix/3550-macos-cgo-error...makew0rld:wails:patch-1
Quality Gate passedIssues Measures |
@leaanthony not sure what's up with auto-merge but this is good to be merged. Would appreciate a release but no problem if it's not convenient. |
Thanks for chasing this up! |
* Copy request to Go memory * Update changelog.mdx * Update v2/pkg/assetserver/webview/responsewriter_darwin.go Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Fix import --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Description
This fix copies Go memory to C memory to ensure that it does not move during a request.
Fixes #3550
Summary by CodeRabbit