GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Publish fail: Request threads can only be created within the context of a running request · Issue #2058 · googleapis/google-cloud-java

Publish fail: Request threads can only be created within the context of a running request #2058

New issue
Copy link
New issue
Copy link
Closed
Closed
Publish fail: Request threads can only be created within the context of a running request#2058
Copy link
Assignees
garrettjonesgoogle
Labels
api: pubsubIssues related to the Pub/Sub API.priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.running on app enginetype: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Description

@gzc
gzc
opened on May 12, 2017
Issue body actions

Hi, I am using appEngine flexible environment with Java8. I am using pubsub0.17.1-alpha. When publishing, I will have this exception. I tried to run publish in a background thread but things are still same.

Following is the exception stack

WARNING: [io.grpc.internal.ManagedChannelImpl-1] 
Failed to resolve name. status=Status{code=UNKNOWN, description=null, cause=java.lang.IllegalStateException: Request threads can only be created within the context of a running request. 
at com.google.appengine.repackaged.com.google.common.base.Preconditions.checkState(Preconditions.java:449) 
at com.google.apphosting.vmruntime.VmRequestThreadFactory.newThread(VmRequestThreadFactory.java:73)
at com.google.common.util.concurrent.ThreadFactoryBuilder$1.newThread(ThreadFactoryBuilder.java:162) 
at java.util.concurrent.ThreadPoolExecutor$Worker.<init>(ThreadPoolExecutor.java:612) 
at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:925) 
at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1368) 
at io.grpc.internal.DnsNameResolver.resolve(DnsNameResolver.java:205) 
at io.grpc.internal.DnsNameResolver.start(DnsNameResolver.java:116) 
at io.grpc.internal.ManagedChannelImpl.exitIdleMode(ManagedChannelImpl.java:313) 
at io.grpc.internal.ManagedChannelImpl$4$1.run(ManagedChannelImpl.java:359) 
at io.grpc.internal.ChannelExecutor.drain(ChannelExecutor.java:87) 
at io.grpc.internal.ManagedChannelImpl$4.get(ManagedChannelImpl.java:361) 
at io.grpc.internal.ClientCallImpl.start(ClientCallImpl.java:221) 
at io.grpc.ForwardingClientCall.start(ForwardingClientCall.java:47) 
at com.google.api.gax.grpc.HeaderInterceptor$1.start(HeaderInterceptor.java:62) 
at io.grpc.stub.ClientCalls.startCall(ClientCalls.java:270) 
at io.grpc.stub.ClientCalls.asyncUnaryRequestCall(ClientCalls.java:249) 
at io.grpc.stub.ClientCalls.futureUnaryCall(ClientCalls.java:186) 
at com.google.pubsub.v1.PublisherGrpc$PublisherFutureStub.publish(PublisherGrpc.java:460) 
at com.google.cloud.pubsub.spi.v1.Publisher.publishOutstandingBatch(Publisher.java:333) 
at com.google.cloud.pubsub.spi.v1.Publisher.access$200(Publisher.java:76) 
at com.google.cloud.pubsub.spi.v1.Publisher$4.run(Publisher.java:271) 
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) 
at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) 
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) 
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) 
at java.lang.Thread.run(Thread.java:745)

Thanks^

Activity

  1. tcoffee-google commented on May 22, 2017

    @tcoffee-google
    tcoffee-google
    on May 22, 2017
    Contributor
    More actions

    @gzc can you provide an example code snippet to help us reproduce the problem? Thanks!

  2. tcoffee-google
    added
    api: pubsubIssues related to the Pub/Sub API.
    on May 22, 2017
  3. garrettjonesgoogle
    added
    priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.
    type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.
    running on app engine
    on Jun 2, 2017
  4. garrettjonesgoogle commented on Jun 2, 2017

    @garrettjonesgoogle
    garrettjonesgoogle
    on Jun 2, 2017
    Contributor
    More actions

    @neozwu could you take a look?

  5. garrettjonesgoogle
    assigned
    neozwu
    on Jun 2, 2017
  6. neozwu commented on Jun 6, 2017

    @neozwu
    neozwu
    on Jun 6, 2017
    Contributor
    More actions

    Hi @gzc , I tested a GAE flex java 8 sample app with publishOutstandingBatch call (using google-cloud-pubsub-0.17.1-alpha), but cannot reproduce this error. Can you provide more information to help repro? I'd like to know in particular the dependency of your project, if possible, and how often you see this error. It is not clear to me why ThreadFactoryBuilder will end up using VmRequestThreadFactory.

  7. gzc commented on Jun 11, 2017

    @gzc
    gzc
    on Jun 11, 2017
    Author
    More actions

    @neozwu Hi,
    I do something trick to bypass using appengine ThreadFactory

    System.clearProperty("com.google.appengine.runtime.environment");
    

    Then I will use java default thread factory and it works.

    My repo has too many dependencies, I will give more info later.

    Thanks ^

  8. garrettjonesgoogle commented on Jul 17, 2017

    @garrettjonesgoogle
    garrettjonesgoogle
    on Jul 17, 2017
    Contributor
    More actions

    I am going to close this issue because it appears that @gzc has a work around. Feel free to open if there are further issues.

  9. garrettjonesgoogle
    closed this as completedon Jul 17, 2017
  10. theacodes
    unassigned
    neozwu
    on Sep 28, 2018
  11. JustinBeckwith
    assigned
    garrettjonesgoogle
    on Feb 1, 2021
  12. chingor13
    added 2 commits that reference this issue on Feb 20, 2026

    deps: update dependency com.google.cloud:google-cloud-bigquery to v2.…

    9346667

    chore(main): release 2.34.2 (#2067)

    7d6684c
  13. suztomo
    added a commit that references this issue on Mar 23, 2026

    deps: update dependency com.google.api.grpc:proto-google-cloud-trace-…

    9277909
  14. meltsufin
    added 5 commits that reference this issue on Apr 29, 2026

    deps: update dependency com.google.cloud:sdk-platform-java-config to …

    a998ef5

    chore(main): release 1.133.0 (#2206)

    a3b6539

    deps: update dependency com.google.cloud:sdk-platform-java-config to …

    2c5da97

    chore(main): release 1.133.0 (#2206)

    1180af9

    chore(main): release 3.30.12 (#2058)

    b2a52c2
  15. benjaminp
    added 2 commits that reference this issue on Jul 13, 2026

    deps: update dependency com.google.truth.extensions:truth-proto-exten…

    477a9d3

    chore(main): release 2.32.0 (googleapis#2073)

    daa5082
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @garrettjonesgoogle
    garrettjonesgoogle

Labels

api: pubsubIssues related to the Pub/Sub API.priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.running on app enginetype: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.