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

Hang while streaming command on Windows #30

Open
ssbotelh opened this issue May 2, 2023 · 2 comments
Open

Hang while streaming command on Windows #30

ssbotelh opened this issue May 2, 2023 · 2 comments

Comments

@ssbotelh
Copy link

ssbotelh commented May 2, 2023

First off, thanks for this library. Awesome project!

I'm seeing a consistent hang when using gnuplot-iostream on Windows, and was hoping you could point me in the right direction to resolve it. These tend to happen when the command is very large (thousands of lines). I attached the debugger, and noticed that it stalls inside some deep boost::iostreams method, not sure if this will mean much to you:

template<>
struct write_device_impl<output> {
    template<typename T>
    static bool put(T& t, typename char_type_of<T>::type c)
    { return t.write(&c, 1) == 1; }

    template<typename T>
    static std::streamsize
    write(T& t, const typename char_type_of<T>::type* s, std::streamsize n)
    { return t.write(s, n); }
};

This is in boost\iostreams\write.hpp, and that last t.write(s,n) call is where it seems to always hang. I tried the exact same code on Linux, and it works fine (plot takes 2 secs to generate). Any pointer will be incredibly helpful. Thank you!

@dstahlke
Copy link
Owner

dstahlke commented May 2, 2023

Sorry, I don't think I can help here. I don't have a development environment on Windows. I suspect that it is gnuplot itself that has hung, and that your program is blocked waiting for gnuplot to finish consuming the input that has been sent so far.

Perhaps you can avoid this problem by sending less text to the gnuplot command input stream. It is possible to write the plot data to a file, and only send the commands (not the data) through the gnuplot input stream. Take a look at demo_tmpfile in example-misc.cc.

@ssbotelh
Copy link
Author

ssbotelh commented May 2, 2023

Thanks for the suggestions!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants