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

Invoke-WebRequest cashes pwsh installed with latest brew and throws malloc error (PowerShell 7.4.2) #21602

Closed
5 tasks done
b3hni4 opened this issue May 3, 2024 · 3 comments
Closed
5 tasks done
Labels
Needs-Triage The issue is new and needs to be triaged by a work group. Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept

Comments

@b3hni4
Copy link

b3hni4 commented May 3, 2024

Prerequisites

Steps to reproduce

This only happens with POST requests to the same uri (GET request works as intended)

$serviceUsername = 'XXX'
$serviceUserPassword = Read-Host -AsSecureString
$cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $serviceUsername, $serviceUserPassword
$body = @{foo = "foo"}
$parameters = @{
          Uri         = "https://xxx.net"
          METHOD      = "POST"
          Credential  = $cred
          Body        = $body | ConvertTo-Json 
          ContentType = 'application/json'
      }
$response = Invoke-WebRequest @parameters
---

pwsh(66802,0x70000453e000) malloc: *** error for object 0x600002bdef20: pointer being freed was not allocated
pwsh(66802,0x70000453e000) malloc: *** set a breakpoint in malloc_error_break to debug
Abort trap: 6

This does not happen in version 7.3.12

Expected behavior

Web request returns as expected.

Actual behavior

Shell crashes.

Error details

Get-Error cannot be called as the shell crashes with the following error

pwsh(66802,0x70000453e000) malloc: *** error for object 0x600002bdef20: pointer being freed was not allocated
pwsh(66802,0x70000453e000) malloc: *** set a breakpoint in malloc_error_break to debug
Abort trap: 6


### Environment data

```powershell
Name                           Value
----                           -----
PSVersion                      7.4.2
PSEdition                      Core
GitCommitId                    7.4.2
OS                             Darwin 23.4.0 Darwin Kernel Version 23.4.0: Fri Mar 15 00:11:05 PDT 2024; root:xnu-10063.101.17~1/RELEASE_X86_64
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Visuals

No response

@b3hni4 b3hni4 added the Needs-Triage The issue is new and needs to be triaged by a work group. label May 3, 2024
@SteveL-MSFT
Copy link
Member

Need more specific steps that repro to be able to debug this. The malloc should be happening within .NET runtime and not within the cmdlet. A simple scenario like invoke-webrequest -uri 'https://httpbin.org/post' -Method Post -Body @{foo='bar'} works.

@SteveL-MSFT SteveL-MSFT added the Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept label May 6, 2024
Copy link
Contributor

This issue has been marked as "Waiting on Author" and has not had any activity for 7 day. It has been closed for housekeeping purposes.

Copy link
Contributor

microsoft-github-policy-service bot commented May 13, 2024

📣 Hey @b3hni4, how did we do? We would love to hear your feedback with the link below! 🗣️

🔗 https://aka.ms/PSRepoFeedback

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs-Triage The issue is new and needs to be triaged by a work group. Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept
Projects
None yet
Development

No branches or pull requests

2 participants