acfr / comma

generic c++ libraries
Other
27 stars 16 forks source link

csv-play / windows : unhandled exception on signal interrupt when using stdout [nice-to-have] #36

Closed sponsoredlinks closed 10 years ago

sponsoredlinks commented 10 years ago

Reproduce (windows)

csv-play "any-file.csv;-"

control-c to exit

Windows debugging prompt comes up, requires user to dismiss it

Console output:

csv-play: an attempt to use invalid file descriptor of: - you probably are trying to use file descriptor of a regular file for select on Windows, which is not supported on Windows

file: ......\io\stream.cpp line: 212 function: unsigned int64 cdecl comma::io::stream<class std::basic_ostream<char,struct std::char_traits > >::fd(void) const

This originates from the second call to multiPlay->close()

This is easy to fix quickly by removing/wrapping in exception handling/not calling if already called on ln145, however I haven't looked further to work out what the nice solution would be

vlaskine commented 10 years ago

it is really puzzling, since this exception is thrown in fd(), but fd() does not seem to be called absolutely anywhere in comma

i don't have a window machine handy; it would be the most efficient, if we could debug it together on your machine; it should not take more than 15-20 minutes; when would be a good time?

sponsoredlinks commented 10 years ago

Hi, yes if you want to have a look I've just got it in the background, so come up anytime. Call stack is as below (note this is on master:97a24b4):

csv-play.exe!comma::io::streamstd::basic_ostream<char,std::char_traits >::fd() Line 209 C++ csv-play.exe!comma::io::select::descriptors::removecomma::io::ostream(const comma::io::ostream & t) Line 94 + 0x2d bytes C++ csv-play.exe!comma::io::impl::publisher::remove(std::_Tree_const_iteratorstd::_Tree_val<std::_Tset_traits<boost::shared_ptr<comma::io::ostream,std::lessboost::shared_ptr,std::allocatorboost::shared_ptr,0> > > * it) Line 278 C++ csv-play.exe!comma::io::impl::publisher::close() Line 260 C++ csv-play.exe!comma::io::publisher::close() Line 48 + 0x2b bytes C++ csv-play.exe!comma::Multiplay::close() Line 99 C++ csv-play.exe!main(int argc, char * * argv) Line 150 C++

vlaskine commented 10 years ago

i may have fixed it; could you please pull comma and try?

please let me know, if the problem still is there (or i have broken anything)

if all works, please close the ticket

thank you

sponsoredlinks commented 10 years ago

Hi, thanks for looking into it. Unfortunately fd appears set to be invalid on construction in windows so looking up the fd() in the if (*it->fd()) check still throws.

A couple of windows-specific things;

vlaskine commented 10 years ago

i guess i better come down; it is almost impossible to debug speculatively

what time is good tomorrow (on thursday)?

as an aside: i doubt that io::select as it is will work on windows altogether - that work never has been done or planned, you are the first user

sponsoredlinks commented 10 years ago

No problems, we got stuck in planning today but anytime tomorrow is good.

I've just guarded the second call to multiplay->close() for now anyway, which works fine for the meantime.

Out of interest the tcp and stdout options appear to work well, for example both the below are perfect as far as I can see

csv-play --speed=2 "c:\code\global-l.txt;tcp:34000" "c:\code\nav-l.txt;tcp:65000" "c:\code\nav-l-adj.txt;tcp:65001" "c:\code\nav-l-camera.txt;tcp:65002"

csv-play --speed=2 "c:\code\global-l.txt;-" "c:\code\nav-l.txt;-" "c:\code\nav-l-adj.txt;-" "c:\code\nav-l-camera.txt;-"

vlaskine commented 10 years ago

"No problems, we got stuck in planning today but anytime tomorrow is good."

which days are today and tomorrow?

sponsoredlinks commented 10 years ago

Fixed for now by wrapping the second call to multiplay->close()