|IRC Nick||Time (GMT-7)||Message|
|FireBreathBot||01:12||JIRA issue http://jira.firebreath.org/browse/FIREBREATH-147 issue commented by [email protected] "I have attached the sample code for reproduce this bug.
JIRA issue http://jira.firebreath.org/browse/FIREBREATH-147 issue updated by [email protected] "Sample code for reproducing this bug."
|linearray||10:12||18.4 million Americans say Facebook got them their current jobs. The numbers for Twitter and Linked in are 10.2 million and 8 million respectively|
|jshanab_wcw||13:12||I have a fundemental socket question. I have a server with an embedded http server feeding my plugin data. when the plugin goes away the server gets stuck with a lingering send. This blocks the thread for that connection from ever exiting. Other than rewriting the library not to use window;s socket send(), is there anything i can do to break the deathgrip?|
|jshanab_wcw||13:12||I guess the mongoose embedded server was not written for this contingency. yuck|
|linearray||13:12||I guess properly closing the connection did cross your mind|
|jshanab_wcw||13:12||Ah,ha. it may be client is sending keep-alive header and defeating timeouts, let me check...
A switch from http1.0 to http 1.1 in headers changes the default, maybe that is what happened.
linearray: facebook did get me my previous job
|FireBreathBot||14:12||JIRA issue http://jira.firebreath.org/browse/FIREBREATH-147 issue commented by richard "okay; that doesn't look like a case I have tested. Thanks for the patch, it may take me a few wee..."|
|dougma||14:12||jshanab_wcw: does sounds to me like a bug in mongoose|
|jshanab_wcw||14:12||They handle timeouts in other areas and shutdwon of server killing stuck connections but I guess they figure if you were there for the request you are there for the response. It is just when we are sending video over HTTP and we suddenly stop accepting it without actually "closeing" the socket, it hangs. If I shut down the whole browser, even though the plugin has all threads closed, it will...
...release. The "async curl shutdown and ignore response for faster page switching" was what messed this up for me
In the last month I went from synchronous http and synchronous rtsp to async on each in two different libs. ouch. that has you spell side effect
|dougma||14:12||ok, i can see that happening.
i use browser streams so never had to trouble myself with curl
|jshanab_wcw||14:12||recipe for stress. come into a project a year or so after it was written in russia by contract and dealt with MJPEG only and add H264,MPEG4 and much much more.
I had a terrible month trying boost::asio,libcurl, and one other. to be honest libcurl was the only one fast enough and smooth enough.
...For low latency video. :-)
|dougma||14:12||cool, i tried low latency video last year with flash... hah!
generating the h264 seemed to be ok, but i just couldn't control the clientside buffering
|jshanab_wcw||14:12||It is odd. I had to settle for some "un smoothness in our almost live playback. I will have to have marketing turn it into a feature. I can smooth out the video more by makeing the buffer larger, but that adds latency. I made it adaptive, it learns but it is security video not a movie so low latency is more important. The recording is smooth.
It is also A camera that reaches out thru the firewall via http to our server. This opens a connectin that it then can do rtsp over. (Hijacking, cool) Then the plugin connects to the server as a subscriber and sends the frames via http. Recording is another subscriber and many many peopel can subscribe to the same video. HLS is next on the subscriber list to write, then RTMP
And then it is on to GPU enhanced transcoding. I got my year planned
|jshanab_wcw||15:12||yup!. The ideas keep stacking up. thank god I am not dealing with sound and all it's timeing issues|
|dougma||15:12||"hey we have this new camera with an audio feed"|
|jshanab_wcw||15:12||Read the federal laws on audio on security cameras, if you even have the capability you can be liable.|
|taxilian||15:12||doesn't surprise me|
|jshanab_wcw||15:12||I want sound, my coworkers think i am nuts. but I think a camera that points to a known url from behind a firewall and can then be watched from any browser (ok, still gotta work on mac build) would be great to take to user group meetings and such
The one at my house is pushing 30fps 640x480 over wifi
|dougma||15:12||when does a webcam become a security cam?
when you're monitoring people without their knowledge?
|jshanab_wcw||15:12||webcam is usually raw video, compressed on the machine. These are IP cameeras, the encoder is embedded in them. But I guess the best answer is when someone does something stupid in front of one. (like the guy that came in thru the roof and then got stuck in the store)|
|linearray||15:12||we define it based on location. outside premises = surveillance cam|
|jshanab_wcw||15:12||Any place that is public can have a camera, anyone can see so it is "public" Any location that is considered private must notify the people there is a camera, so no hidden camera. I guess that is why sound is an issue
I think recording the video is one big think. The camera on my front porch could be considered just a convience or safety, but if I record the video then it definitly crosses a line
I hate the boost join sometimes. it takes extraordinary effort to join a thread that may or may not of exited. AND the failure mode is hang forever
|linearray||15:12||use timed join then
with a timeout of 0
|jshanab_wcw||15:12||Good idea. I will lok that up.|
|jshanab_wcw||15:12||what i don't understand is why the documentation is just not right. it says join() works for already exited threads but I have nerver found that to be true. (maybe pthread based, but not on windows at least)
why all zero's
|taxilian||15:12||I've never had an issue with doing a join on an exited thread
always works for me :-?
|linearray||15:12||it probably just did not finish :)|
|jshanab_wcw||15:12||I think i am hitting the "in the process of exiting cases" I must be doing something wrong, it happens a lot to me|
|dougma||15:12||but you want to wait forever!|
|taxilian||15:12||Every time I've done a join on a thread that may or may not have already exited it has worked… and when I used logging I could verify that sometimes it had already exited and it joined successfully
maybe I'm using a different version of boost?
|jshanab_wcw||15:12||No. It has finished. If I join before it exits, no problem, but if anything allows it to exit before I join it is stuck in the join's interruptable wait. but a debug session proves there is not thred anymore, it is destroyed|
|dougma||15:12||are you at process exit time?
too late then...
|taxilian||15:12||here are others who are reporting that it works for them
oh, yeah… you aren't trying to join in a static destructor or anything, right?
|jshanab_wcw||15:12||static destructor? I do not think i have ever seen one of those|
|dougma||15:12||dll unload is not a good time either|
|taxilian||15:12||the destructor of an object that is declared as static, that is
a static variable destructs at dll unload time
same with a global variable
that means it tries to unload during DllMain's final call, which is serial (no other threads can run at the same time) and so a join will never return
|jshanab_wcw||15:12||It is the stopping of a thred in my plugin started when the user hits play that pulls video from the server. On detached event, it is one of the things I stop on the wayt down.|
|taxilian||15:12||hmm. that should be safe
I'd have to look at your code; I've definitely seen it work, though
|jshanab_wcw||15:12||Careful what you wish for :-)|
|taxilian||15:12||so if you are seeing something different, I would guess you have something unusal happening; perhaps an unhandled exception?
I can look at it if you want; I won't sign an NDA, but you know me well enough by now to know that I'm not going to walk off and sell or steal your code
|jshanab_wcw||15:12||An unhandled exception might be the culprit...|
|taxilian||15:12||if the thread terminated in a non-standard way that could certainly circumvent the normal boost handling...|
|jshanab_wcw||15:12||I have given you control of my box in the past. I definitly trust you, and BTW, you have gone above and beyond the call of duty helping me, (despite my bosses not following thru on their promise to send money)
glaciers move faster sometimes than funds
|linearray||15:12||style question: use globals or static classes in StaticInitialize()?|
|jshanab_wcw||15:12||SON-of-a-gun. looks like an empty try-catch did do the trick.|
|taxilian||15:12||linearray: they are the same, really
a global or a static variable on something
just make sure you clean them up in StaticDeinitialize
I usually use a scoped_array or shared_array and then just do .reset() in Deinitialize
|taxilian||15:12||jshanab_wcw: i'll be a gentleman and I won't say "I told you so" ;-)|
|jshanab_wcw||15:12||What was nice working in a larger company was plenty of peer review and easy to find someone who may have solved the issue before. Here I am the c/c++ guy|
|taxilian||15:12||yeah, I know how that goes|
|linearray||15:12||and if you had to prevent your plugin from running in multiple browsers at once, to prevent your head from spinning because of synchronization issues any more than it already does, would you agree that checking if a local socket is open and opening it in StaticInitialize() is a good way to do that?|
|taxilian||15:12||that's why I like having this room; it's good to have people around who you can ask about things =]
the downside is that most people assume I'm the expert… :-/
linearray: that'd work; in windows you can use a system-level mutex instead, or you could open and lock a file, or...
well, there are several options
|jshanab_wcw||15:12||er...cause you are oh exhaulted one. Jeff bows|
|taxilian||15:12||but that one sounds reasonableish
|linearray||15:12||I thought about lock files but worried about clean-up when crashing|
|taxilian||15:12||linearray: at least on windows you can tell if a program has the file open; not sure on posix|
|linearray||15:12||that sounds interesting, I'll look into that|
|taxilian||15:12||I'd look at a system-wide semaphore of some sort first
then again, it depends on your reason for not wanting multiple versions running
|linearray||15:12||less worrying about shared resources... both locally as well as on the server I use to push data to the client|
|linearray||15:12||and there is absolutely no point in having it open in multiple browsers
in fact there is no point to having it open in more than one tab
|jshanab_wcw||15:12||Are cookies shared between browsers, could you put a refcount in a cookie?|
|linearray||15:12||nope, they are not
a portable file-based solution would be perfect
|jshanab_wcw||15:12||I thouht boost mutexes and conditions were good across processes. I don't know where i saw that though|
|taxilian||15:12||the only question is whether or not the named_semaphore will get reset if the process holding it crashes
that I don't know
|linearray||15:12||that I will find out|
|taxilian||15:12||let me know; this would be a useful thing to write up a blog post about, btw
also, while you're experimenting if you stumble across something that would let you detect from a child process that a well-known parent process has disappeared (perhaps waiting on a semaphore) that would be *really* useful
|linearray||16:12||what exactly do you mean by disappear?|
|taxilian||16:12||close, crash, etc|
|linearray||16:12||and how well-known is the parent?
|taxilian||16:12||let me explain my use case
I want to be able to start a process to run some of my plugin logic
so that if it crashes I can recover without taking out the browser
and so that I can detect crash logs, etc
the problem is, once I launch the process, how do I tell if something happens to the browser or hte plugin process so that the child process doesn't remain running as a zombie?
|jshanab_wcw||16:12||reverse the logic? Assume the worst and let the plugin notify you all is well periodically|
|taxilian||16:12||yeah, that's an option; would prefer something that I don't have to rely on polling, though|
|linearray||16:12||do browsers remove the plugin process on crash?|
|taxilian||16:12||one thought I've had is to grab a semaphore and then launch the process; then have the process wait on the semaphore
as soon as the plugin process goes away it loses the semaphore and the process grabs it and exits
on crash the plugin process goes away, yes
|jshanab_wcw||16:12||Not so much pulling as much as a watchdog counting down. if it gets woken up it goes back to counting down from the top. if it fails to get the wakeup, then the other guy must be in trouble|
|taxilian||16:12||yeah; and that's an option. just was hoping for something cleaner =]|
|jshanab_wcw||16:12||OK, this is sad. I can see by the video from my house that it is getting dark so therfore time to go home,especially for a saturday. The sad part is I sit next to a window and didn't notice|
|linearray||16:12||A file locking is a class that has process lifetime. This means that if a process holding a file lock ends or crashes, the operating system will automatically unlock it.
I think I will use this then
|jshanab_wcw||16:12||That works in linux really well. they have a directory for them. Will it work in windows as well, it sometimes has issues with shared access. maybe boost filesystem will abstract that.|
this comes from boost::interprocess :)
they took care of that, I hope
|jshanab_wcw||16:12||ah. very cool. I may need that myself
alright, headed home guys. C-ya
linearray: please keep me posted how that works for you
|linearray||16:12||I think the other synchronization mechanism do not buy you this auto-cleanup on crash
in fact it is hard to conceive how they could
|taxilian||16:12||well, as I've said… I know that on windows a system mutex can|
|linearray||16:12||another thing you can do of course is try and see if the parent PID still exists|
|taxilian||16:12||I've used it before
but I don't know about posix systems
|linearray||16:12||yeah, I mean you need OS support for that|
|taxilian||16:12||well, I go now. have fun
and good luck