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

Gradio queue function not work at windows 2019 server powershell #4243

Closed
1 task done
tianlichunhong opened this issue May 17, 2023 · 9 comments
Closed
1 task done
Labels
bug Something isn't working

Comments

@tianlichunhong
Copy link

Describe the bug

show erro in the web page.

Is there an existing issue for this?

  • I have searched the existing issues

Reproduction

import gradio as gr
import sys
class Logger:
def init(self, filename):
self.terminal = sys.stdout
self.log = open(filename, "w")

def write(self, message):
    self.terminal.write(message)
    self.log.write(message)

def flush(self):
    self.terminal.flush()
    self.log.flush()

def isatty(self):
    return False

sys.stdout = Logger("output.log")
def test(x):
print("This is a test")
print(f"Your function is running with input {x}...")
return x

def read_logs():
sys.stdout.flush()
with open("output.log", "r") as f:
return f.read()
with gr.Blocks() as demo:
with gr.Row():
input = gr.Textbox()
output = gr.Textbox()
btn = gr.Button("Run")
btn.click(test, input, output)

logs = gr.Textbox()
demo.load(read_logs, None, logs, every=1)

demo.queue().launch()

Screenshot

No response

Logs

Running on local URL:  http://127.0.0.1:7860

To create a public link, set `share=True` in `launch()`.
Task exception was never retrieved
future: <Task finished name='74u3hieboyy_1' coro=<Queue.process_events() done, defined at C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\gradio\queueing.py:343> exception=ValueError('[<gradio.queueing.Event object at 0x000001BD29154610>] is not in list')>
Traceback (most recent call last):
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\gradio\queueing.py", line 432, in process_events
    self.active_jobs[self.active_jobs.index(events)] = None
ValueError: [<gradio.queueing.Event object at 0x000001BD29154610>] is not in list

System Info

Windows 2019 powershell

Severity

annoying

@tianlichunhong tianlichunhong added the bug Something isn't working label May 17, 2023
@tianlichunhong
Copy link
Author

not only this code not work, any code with demo.queue() does not work. without demo.queue(), it works fine.

@freddyaboulton
Copy link
Collaborator

Hi @tianlichunhong ! What version of gradio are you using?

@tianlichunhong
Copy link
Author

Hi @tianlichunhong ! What version of gradio are you using?

version from 3.25.0 to 3.31.0 all have the problem. And i had found the reason. It is the OS proxy. When set a proxy for OS, queue doesn't work. When delete the OS proxy, then start gradio with queue, it works fine. After the gradio start, then you set a proxy for OS, it doesn't impact, gradio works normal.

@abidlabs
Copy link
Member

abidlabs commented May 17, 2023

Hi @tianlichunhong what do you mean by OS proxy? Can you provide step-by-step instructions on what you mean by "setting a proxy" so that we can try to reproduce and fix this issue?

@abidlabs abidlabs added needs repro Awaiting full reproduction and removed bug Something isn't working labels May 21, 2023
@abidlabs
Copy link
Member

I'll go ahead and close this for lack of follow up. But if you are able to provide a clear repro @tianlichunhong, feel free to reopen

@tianlichunhong
Copy link
Author

sorry for late reply. I mean set windows proxy is like that:
img_589cc490d7dd5

When I set the proxy, and in my python, use demo.queue() , and run gradio. it can run, but input text, and summit, then after about 10s, show the error.
When I remove the proxy for windows. All run fine.

@abidlabs
Copy link
Member

Thanks @tianlichunhong I'll reopen so that we can take a look at this

@abidlabs abidlabs reopened this May 22, 2023
@abidlabs abidlabs added bug Something isn't working and removed needs repro Awaiting full reproduction labels May 29, 2023
@abidlabs
Copy link
Member

abidlabs commented Aug 2, 2023

Hi @tianlichunhong I don't think we can solve this on our end. Probably the Windows LAN proxy you are using does not support websockets. Sometimes, there are proxies that don't support websockets for "security reasons": https://stackoverflow.com/questions/9612690/websockets-and-a-proxy

@abidlabs abidlabs closed this as completed Aug 2, 2023
@tianlichunhong
Copy link
Author

Hi @tianlichunhong I don't think we can solve this on our end. Probably the Windows LAN proxy you are using does not support websockets. Sometimes, there are proxies that don't support websockets for "security reasons": https://stackoverflow.com/questions/9612690/websockets-and-a-proxy

Thank you very much! Is there any way to set gradio proxy? for example to set proxy=none.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants