Opened 11 years ago

Closed 10 years ago

#2860 closed defect (invalid)

Coolstream CNXT Crash when oscam restart

Reported by: Philipp Owned by:
Priority: critical Component: DVBApi
Severity: high Keywords:
Cc: Sensitive: yes




Issue Description

Oscam should do a KAL Trace Terminating like mgcamd, otherwise we got a curious CNXT crash when oscam restart on a descrambled channel. After this error, the channel is no longer be descrambled. I`ve logged Oscam restart, mgcamd restart and every issue in Coolstream log. So u can see the difference.
This error was never fixed before!

When the issue occurs

Restart Oscam in Coolstream on a descrambled channel

How the issue is reproducable

see above

Log as an attachment.

Attachments (2)

oscam_coolstream_cnxt.log (13.1 KB ) - added by Philipp 11 years ago.
cooltryfix.patch (448 bytes ) - added by theparasol 11 years ago.
V4... idea by GF... as it is simple it should work, simple always works ;)

Download all attachments as: .zip

Change History (18)

by Philipp, 11 years ago

Attachment: oscam_coolstream_cnxt.log added

comment:1 by theparasol, 11 years ago

Looked into it but the needed api call isnt defined in oscam and I'm not into that "cool" to add it. You will have to wait for a dev that is into that cool stuff like dingo35 (?)

comment:2 by Philipp, 11 years ago

There is always a function cnxt_kal_terminate(); in coolapi.h defined and used in module-dvbapi-coolapi.c. Maybe we can used it at start or end of oscam.
First there must be a way to close down oscam like mgcamd, cuz users often use
killall -9 oscam. But..., maybe the code works at start of oscam, too.

Last edited 11 years ago by Philipp (previous) (diff)

comment:3 by Philipp, 11 years ago

Seems that is it easy to fix.
We must only call coolapi_close_all(), when restart is called, like in cs_exit();

edit: doesnt work.
But kill pidof oscam does it right. After a new start on same channel it works.

Last edited 11 years ago by Philipp (previous) (diff)

comment:4 by gf, 11 years ago

There is no need for the ifdefs and the reordering of defines in oscam.c

comment:5 by theparasol, 11 years ago

I thought if not using ifdefs these functions are always called even if not compiled with azboxapi or coolapi. Seems to me pretty useless. Am I mistaken?

comment:6 by gf, 11 years ago

By the way the real problem with oscam currently is that signal handling is completely busted so nothing from the cleanup functions is executed for example when SIGINT is received. Fixing it is tricky because of the "restart" logic. I have tried to fix the signal handling but quickly got into a mess so I left it for later.

Please don't add new ifdefs, the functions you are using are already replaced with static inline versions in case the functionality is disabled:

#if defined(HAVE_DVBAPI) && defined(WITH_COOLAPI)
extern void coolapi_open_all(void);
extern void coolapi_close_all(void);
static inline void coolapi_open_all(void) { }
static inline void coolapi_close_all(void) { }

#if defined(HAVE_DVBAPI) && defined(WITH_AZBOX)
void azbox_init(void);
void azbox_close(void);
static inline void azbox_init(void) { }
static inline void azbox_close(void) { }

I removed quite a lot ifdefs using this technique.

Last edited 11 years ago by gf (previous) (diff)

comment:7 by gf, 11 years ago

Won't this break csctapi/ifd_cool.c ?

comment:8 by theparasol, 11 years ago

Won't this break csctapi/ifd_cool.c ?
Good point... never knew it was there. Lets wait and see ;)

comment:9 by gf, 11 years ago

It would be better to put coolapi_close_all() before coolapi_open_all() in oscam.c and if needed move the two calls up a bit so a restart would execute the code.

comment:10 by theparasol, 11 years ago

Agreed... this time you make the patch to test!

comment:11 by gf, 11 years ago

diff --git a/oscam.c b/oscam.c
index f9bc059..1c9cac6 100644
--- a/oscam.c
+++ b/oscam.c
@@ -3963,6 +3963,7 @@ int32_t main (int32_t argc, char *argv[])
   cs_lock_create(&fakeuser_lock, 5, "fakeuser_lock");
   cs_lock_create(&ecmcache_lock, 5, "ecmcache_lock");
   cs_lock_create(&readdir_lock, 5, "readdir_lock");
+  coolapi_close_all();

by theparasol, 11 years ago

Attachment: cooltryfix.patch added

V4... idea by GF... as it is simple it should work, simple always works ;)

comment:12 by Philipp, 11 years ago

didnt work. can u add some code, to see that the function is called at restart?

comment:13 by gf, 11 years ago

The whole restart thing is kind of broken. The problem with restart is that oscam do not execute the cleanup code and that is the problem, whatever we try to do on the start if we don't execute the cleanup code we'll have errors.

comment:14 by Philipp, 11 years ago

OK, take your time. :) I can wait

comment:15 by Philipp, 10 years ago

Hi, any news?

comment:16 by Deas, 10 years ago

Resolution: invalid
Status: newclosed

as discussed with depp0n: if you hard kill oscam there is no way oscam can close it´s filters. so don´t use killall -9. the oscam restart behaviour was recently fixed by Admin, but this has nothing to do with it as it is a hard kill.

Note: See TracTickets for help on using tickets.