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

gRPC example project is failing on GitHub Windows agent #295

Closed
rholshausen opened this issue Jun 8, 2023 · 10 comments
Closed

gRPC example project is failing on GitHub Windows agent #295

rholshausen opened this issue Jun 8, 2023 · 10 comments
Labels
bug Indicates an unexpected problem or unintended behavior

Comments

@rholshausen
Copy link
Contributor

Software versions

  • OS: Windows
  • Consumer Pact library: v2.0.0-beta.21
  • Provider Pact library: N/A
  • Golang Version: 1.19.x
  • Golang environment: CI

Example project https://github.com/pact-foundation/pact-plugins/tree/main/examples/gRPC/area_calculator/consumer-go was upgraded to the latest Pact-Go using the following commands:

go get github.com/pact-foundation/pact-go/v2
go mod vendor

See commit pact-foundation/pact-plugins@5f293ae

The CI build is now failing on Windows (https://github.com/pact-foundation/pact-plugins/actions/runs/5206582349/jobs/9393298774) with the following error:

==== RUNNING consumer-go
# github.com/pact-foundation/pact-go/v2/internal/native
Error: vendor\github.com\pact-foundation\pact-go\v2\internal\native\message_server.go:505:97: cannot use _Ctype_ulong(i) (value of type _Ctype_ulong) as type _Ctype_ulonglong in variable declaration
Error: vendor\github.com\pact-foundation\pact-go\v2\internal\native\message_server.go:509:95: cannot use _Ctype_ulong(i) (value of type _Ctype_ulong) as type _Ctype_ulonglong in variable declaration
Error: Process completed with exit code 2.
@mefellows mefellows added bug Indicates an unexpected problem or unintended behavior triage labels Jun 8, 2023
@mefellows
Copy link
Member

Hmm, interesting, thanks. I test on Windows here too and the gRPC tests are passing. I wonder if it's a C lib dependency or something going on, or version of Go.

@mefellows
Copy link
Member

Yeah, I think it's the use of size_t here which is going to vary across OS/Architecturces

// Definition..
const unsigned char *pactffi_sync_message_get_response_contents_bin(const struct SynchronousMessage *message, size_t index);
size_t pactffi_sync_message_get_response_contents_length(const struct SynchronousMessage *message, size_t index);

But the implementation uses an unsigned long, which is a different type (but obviously matches the types on current targets).

len := C.pactffi_sync_message_get_response_contents_length(message, C.ulong(i))
if len == 0 {
	return nil, errors.New("retrieved an empty message")
}
data := C.pactffi_sync_message_get_response_contents_bin(message, C.ulong(i))
if data == nil {
	return nil, errors.New("retrieved an empty pointer to the message contents")
}
...

mefellows added a commit that referenced this issue Jun 8, 2023
fix: remove relative numeric size for message contents c interface. Fixes #295.
@github-actions
Copy link

github-actions bot commented Jun 8, 2023

👋 Hi! The 'smartbear-supported' label has just been added to this issue, which will create an internal tracking ticket in PactFlow's Jira (PACT-1075). We will use this to prioritise and assign a team member to this task. All activity will be public on this ticket. For now, sit tight and we'll update this ticket once we have more information on the next steps.

See our documentation for more information.

@mefellows
Copy link
Member

@rholshausen released v2.0.0-beta.22 - mind seeing if the latest fixes it?

I think they're the only two locations in the code that have size_t in the signature that are explicitly typed in code - hence the compilation errors.

@rholshausen
Copy link
Contributor Author

Lots of example projects are failing across different OSs for different reasons on GitHub. Something must have been changed on the agents.

@mefellows
Copy link
Member

🤦

Maybe you've been opted into an experiment :P

@rholshausen
Copy link
Contributor Author

It is now failing with

==== RUNNING consumer-go
# area_calculator/consumer.test
C:\hostedtoolcache\windows\go\1.19.9\x64\pkg\tool\windows_amd64\link.exe: running gcc failed: exit status 1
c:/programdata/chocolatey/lib/mingw/tools/install/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\RUNNER~1\AppData\Local\Temp\go-link-1851368132\000004.o: in function `_cgo_d1fc9e9a1507_Cfunc_pactffi_verifier_add_provider_transport':
C:\Users\runneradmin\AppData\Local\Temp\go-build3390115657\b091/cgo-gcc-prolog:94: undefined reference to `pactffi_verifier_add_provider_transport'
collect2.exe: error: ld returned 1 exit status

But only on Windows.

@rholshausen
Copy link
Contributor Author

@rholshausen
Copy link
Contributor Author

Green build!

@mefellows
Copy link
Member

ah!

I noticed the pact-go install command is commented out. I thought I'd fixed it on Windows but perhaps I didn't.

I'll create a tracking issue to follow it up now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

2 participants