protoc-bridge icon indicating copy to clipboard operation
protoc-bridge copied to clipboard

Compile / protocGenerate just hangs

Open nefilim opened this issue 6 months ago • 1 comments

This happens 100% of the time, it never works on this macOS 15.5 host.

addSbtPlugin("com.thesamet" % "sbt-protoc" % "1.0.8")

libraryDependencies += "com.thesamet.scalapb" %% "compilerplugin" % "0.11.18"

The same project works fine on a CI server and on another laptop (with the same version of macOS and JDK 21).

While it's just hanging, I can see that the protoc jvm plugin (netcat shell script) is running and I'm able to connect to the random port it created. I tried specifying a newer version of the protoc explicitly:

PB.protocVersion := "-v3.25.8"

but no change. I tried manually running the forked process:

/Users/peter/Library/Caches/com.thesamet.scalapb.protocbridge.protocbridge/v1/protoc-osx-aarch_64-3.25.8 --plugin=protoc-gen-jvm_0=/var/folders/36/w_9_nw513hjgflwgzm0qg_m40000gn/T/protocbridge5085698182157995314 --jvm_0_out=/Users/peter/develop/xxx/notification-tracking-system/notification-tracking-system-model/target/scala-2.13/src_managed/main/scalapb --jvm_0_opt=grpc -I/Users/peter/develop/xxx/notification-tracking-system/notification-tracking-system-model/src/main/protobuf /Users/peter/develop/xxx/notification-tracking-system/notification-tracking-system-model/src/main/protobuf/nts.proto

that also just never finishes. Any idea how I can troubleshoot this further?

nefilim avatar Jun 11 '25 18:06 nefilim

When comparing tags (0.9.9 that fails and 0.9.7 that works on my machine), a new MacPluginFrontend has been introduced and since this issue fails on Mac only it seems related

Iilun avatar Jul 10 '25 13:07 Iilun

I have the exact same problem. I also tried with JDK 17 and 25.

This is the combination that works for me:

addSbtPlugin("com.thesamet" % "sbt-protoc" % "1.0.7")
libraryDependencies += "com.thesamet.scalapb" %% "compilerplugin" % "0.11.17"

If I try to use sbt-protoc 1.0.8 with compilerplugin 0.11.17 it fails. If I try to use sbt-protoc 1.0.7 with compilerplugin 0.11.18 (or above) it fails.

@thesamet is there anything I can help with to debug this problem?

simaomartins-visma avatar Nov 11 '25 13:11 simaomartins-visma

I think it would be better to bring the original Mac plugin in protoc-bridge as the default, and make the current one "experimental" so only users who have problems with the original one use the experimental. It will be sufficient to expose the experimental one through an environment variable such as PROTOCBRIDGE_EXPERIMENTAL_OSX_PLUGIN. PR will be welcome.

thesamet avatar Nov 16 '25 05:11 thesamet

If I ran sbt debug protocGenerate I see:

Executing protoc with [--plugin=protoc-gen-jvm_1=/var/folders/lk/83m__10n01q8hvgvvl1zn9gw0000gn/T/protocbridge6330618738507915955, ...

Doing cat /var/folders/lk/83m__10n01q8hvgvvl1zn9gw0000gn/T/protocbridge6330618738507915955 I see:

#!/bin/sh
set -e
nc 127.0.0.1 64333
      

And doing sudo lsof -i :64333 I see

COMMAND   PID  USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
java    77395 simao  282u  IPv6 0xea082a9ee3a8d4d8      0t0  TCP localhost:64333 (LISTEN)
java    77395 simao  284u  IPv6 0x1820adc03dcf6d19      0t0  TCP localhost:64333->localhost:64336 (ESTABLISHED)
netcat  78447 simao    3u  IPv4 0x8dfbb13ee4323ab5      0t0  TCP localhost:64336->localhost:64333 (ESTABLISHED)

So it looks like the backend java application that should be answering requests for the protocbridge is somehow stuck. Is there any way for me to start it with some debug logs?

simaomartins-visma avatar Nov 27 '25 15:11 simaomartins-visma