Info | Message |
---|---|
1) Message boards : Web interfaces : new boinc project w extra web features
Message 3384 Posted 7 Mar 2006 by m.somers |
Not yet fully 'public', but we are getting there; it's time to switch to the new and permanent URL: http://boinc.gorlaeus.net m. |
2) Message boards : Server programs : running server software in sandbox
Message 3040 Posted 12 Feb 2006 by m.somers |
Hi, during the period of setting up the boinc test server I came across the fact that by default the server software runs as user root on the system. This is not always a good thing! To allow the server deamons to be able to run as non-root and apache too, I had to patch the server software; the files uploaded by clients are made group/world writeable and the directories created when using the fan-out features, are also group/world writable. Now the file_upload_handler cgi script running as i.e. 'wwwrun' creates files that can be removed by the file_deleter deamon running as i.e. 'boinc'. This allows for the server deamons to run as non-root and that protects the system a bit more if a critical deamon/cgi script goes haywire... The lib/filesys.C patch: --- boinc/lib/filesys.C 2005-07-14 18:46:38.000000000 +0200 +++ Boinc_2005-10-06_source_fixes.dir/lib/filesys.C 2006-02-12 18:36:15.229663336 +0100 @@ -17,6 +17,10 @@ // or write to the Free Software Foundation, Inc., // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +// M.F.Somers UPDATE: make files uploaded world writeable so other deamons running +// with different user ID actually can delete them files ! + #if defined(_WIN32) && !defined(__STDWX_H__) && !defined(_BOINC_WIN_) && !defined(_AFX_STDAFX_H_) #include "boinc_win.h" #endif @@ -443,7 +447,15 @@ #ifdef _WIN32 return !CreateDirectory(path, NULL); #else - return mkdir(path, 0777); +// return mkdir(path, 0777); +// M.F.Somers UPDATE: Set group write bits for non-root file-deleter to be able to delete files... + + mode_t old_mask = umask( 00000 ); + int retval = mkdir( path, 0777 ); + chmod( path, 0777 ); + umask( old_mask ); + + return( retval ); #endif } and the sched/file_upload_handler.C patch: --- boinc/sched/file_upload_handler.C 2005-10-04 20:30:49.000000000 +0200 +++ Boinc_2005-10-06_source_fixes.dir/sched/file_upload_handler.C 2006-02-12 18:36:11.598215400 +0100 @@ -17,6 +17,9 @@ // or write to the Free Software Foundation, Inc., // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// M.F.Somers UPDATE: added the write flags for group and others so the filedeleter deamon, running as non-root +// is allowed to delete the created files... + // The BOINC file upload handler. // See doc/upload.html for protocol spec. // @@ -145,10 +148,15 @@ // open file. We use raw IO not buffered IO so that we can use reliable // posix file locking. Advisory file locking is not guaranteed reliable when // used with stream buffered IO. - int fd=open(path, O_WRONLY|O_CREAT|O_APPEND, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH); + +// M.F.Somers UPDATE: added the write flags for group and others so the filedeleter deamon, running as non-root +// is allowed to delete the created files ;-)... + + int fd=open(path, O_WRONLY|O_CREAT|O_APPEND, S_IRUSR|S_IWUSR|S_IWGRP|S_IRGRP|S_IWOTH|S_IROTH); if (fd<0) { return return_error(ERR_TRANSIENT, "can't open file %s: %s\\n", path, strerror(errno)); } + fchmod( fd, S_IRUSR|S_IWUSR|S_IWGRP|S_IRGRP|S_IWOTH|S_IROTH ); // Put an advisory lock on the file. This will prevent OTHER instances of file_upload_handler // from being able to write to the file. Cheers, mark somers. |
3) Message boards : API : applications generate errors and crash clients with freeglut
Message 3039 Posted 12 Feb 2006 by m.somers |
Hi, I've noticed that applications, graphical ones, that use freeglut, on linux specifically, generate huge amounts of error messages. If, through the boinc manager, a graphical view is closed en re-opened, error messages to stderr are produced. They end up in the stderr.txt file on the host of the client, filling up the disk and eventually put the system to a halt. Not nice for a host doing work for you ;-) The reason that this happens is because in the API a bug is present in the x_opengl.C file. It was unnoticed probably because with the original glut library, no error messages are produced because of the 'bad-glutting'. I have restructured the x_opengl.C code and got rid of that nasty bug. Now when a graphical view is closed, and reopened, you actually do get a new view and not millions of error messages. Moreover, the code now works correctly with both the original glut library and the freeglut library. Here is the patch (created with diff) on the 5.3 version of 10-06-2005: --- boinc/api/x_opengl.C 2005-09-06 14:58:55.000000000 +0200 +++ Boinc_2005-10-06_source_fixes.dir/api/x_opengl.C 2006-02-12 18:36:14.071839352 +0100 @@ -17,6 +17,15 @@ // or write to the Free Software Foundation, Inc., // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// M.F.Somers UPDATE: +// +// Removed an anoying bug when using GLUT. Apparently the glutMainloop +// and the glutDestoryWindow routines are being kept called as soon as a user +// hits the x button of the window, but glutInit isn't recalled... After +// having removed the bug, also made the code a bit easier to understand... + +// #define _DEBUG + #include <stdlib.h> #include <stdio.h> #include <setjmp.h> @@ -138,106 +147,67 @@ } } -void CloseWindow() { - set_mode(MODE_HIDE_GRAPHICS); -} - -static void make_new_window(int mode) { - if ( (mode != MODE_WINDOW) && (mode != MODE_FULLSCREEN) ) { - // nothing to be done here - return; - } - - if (!glut_is_initialized) { - boinc_glut_init(); - } +static void boinc_glut_init( void ) { + const char* args[2] = {"screensaver", NULL}; + int one=1; + + app_debug_msg("Called patched boinc_glut_init()... \\n"); + + if( glut_is_initialized ) return; + + glutInit (&one, (char**)args); + glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); + glutInitWindowPosition(xpos, ypos); + glutInitWindowSize(600, 400); - app_debug_msg("make_new_window(): now calling glutCreateWindow(%s)...\\n", aid.app_name); win = glutCreateWindow(aid.app_name); - app_debug_msg("glutCreateWindow() succeeded. win = %d\\n", win); - - // installing callbacks for the current window glutReshapeFunc(app_graphics_resize); glutKeyboardFunc(keyboardD); glutKeyboardUpFunc(keyboardU); glutMouseFunc(mouse_click); glutMotionFunc(mouse_click_move); glutDisplayFunc(maybe_render); + glEnable(GL_DEPTH_TEST); + #ifdef __APPLE__ - glutWMCloseFunc(CloseWindow); // Enable the window's close box BringAppToFront(); #endif - app_graphics_init(); - if (mode == MODE_FULLSCREEN) { - glutFullScreen(); - } + app_graphics_init(); + + glut_is_initialized = true; return; } -// initialized glut and screensaver-graphics -// this should only called once, even if restarted by user-exit -// -static void boinc_glut_init() { - const char* args[2] = {"screensaver", NULL}; - int one=1; - app_debug_msg("Calling glutInit()... \\n"); - glutInit (&one, (char**)args); - app_debug_msg("...survived glutInit(). \\n"); - - glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); - glutInitWindowPosition(xpos, ypos); - glutInitWindowSize(600, 400); - g_bmsp->boinc_get_init_data_hook(aid); - if (!strlen(aid.app_name)) { - strcpy(aid.app_name, "BOINC Application"); - } - - glut_is_initialized = true; - return; +// M.F.Somers UPDATE: this has been simplified... +void set_mode(int mode) { -} + app_debug_msg("Called patched set_mode(%d): current_mode = %d.\\n", mode, current_graphics_mode); -// Destroy current window if any -// -void KillWindow() { - if (win) { - int oldwin = win; - win = 0; // set this to 0 FIRST to avoid recursion if the following call fails. - glutDestroyWindow(oldwin); - } -} + if (!glut_is_initialized) boinc_glut_init(); -void set_mode(int mode) { - if (mode == current_graphics_mode) { #ifdef __APPLE__ - // Bring graphics window to front whenever user presses "Show graphics" - if (mode == MODE_WINDOW) - BringAppToFront(); + if (mode == MODE_WINDOW) + BringAppToFront(); +#else + if (mode == MODE_WINDOW) + glutShowWindow(); #endif - return; - } - - app_debug_msg("set_mode(%d): current_mode = %d.\\n", mode, current_graphics_mode); - if (glut_is_initialized) { - app_debug_msg("Calling KillWindow(): win = %d\\n", win); - KillWindow(); - app_debug_msg("...KillWindow() survived.\\n"); - } - - if (mode != MODE_HIDE_GRAPHICS) { - app_debug_msg("set_mode(): Calling make_new_window(%d)\\n", mode); - make_new_window(mode); - app_debug_msg("...make_new_window() survived.\\n"); - } + #ifdef __APPLE__ - else + if (mode == MODE_HIDE_GRAPHICS) HideThisApp(); +#else + if (mode == MODE_HIDE_GRAPHICS) + glutHideWindow(); #endif + if (mode == MODE_FULLSCREEN) + glutFullScreen(); + current_graphics_mode = mode; return; @@ -278,7 +248,7 @@ case MODE_HIDE_GRAPHICS: case MODE_WINDOW: case MODE_FULLSCREEN: - case MODE_BLANKSCREEN: + case MODE_BLANKSCREEN:if( current_graphics_mode == MODE_HIDE_GRAPHICS ) if (strlen(m.display)) { sprintf(buf, "DISPLAY=%s", m.display); putenv(buf); @@ -403,6 +373,11 @@ // handle glut's notorious exits().. atexit(restart); + g_bmsp->boinc_get_init_data_hook(aid); + if (!strlen(aid.app_name)) { + strcpy(aid.app_name, "BOINC Application"); + } + // THIS IS THE re-entry point at exit or ABORT in the graphics-thread restarted = setjmp(jbuf); @@ -415,6 +390,12 @@ } } +// M.F.Somers UPDATE: there the fix is for the anoying bug... however, the code +// has been restructured so it also works with freeglut... + glut_is_initialized = false; + win = 0; + current_graphics_mode = MODE_HIDE_GRAPHICS; + if (boinc_is_standalone()) { if (restarted) { while(1) { @@ -425,30 +406,27 @@ set_mode(MODE_WINDOW); glutTimerFunc(TIMER_INTERVAL_MSEC, timer_handler, 0); } - } else { - if (!glut_is_initialized) { + + app_debug_msg ("Running standalone, now calling glutMainLoop()...\\n"); + glutMainLoop(); + app_debug_msg ("glutMainLoop() returned...\\n"); + return; + } + #ifdef __APPLE__ - setMacPList(); + setMacPList(); #endif - set_mode(MODE_HIDE_GRAPHICS); - while ( current_graphics_mode == MODE_HIDE_GRAPHICS ) { - app_debug_msg ("Graphics-thread now waiting for client-message...\\n"); - wait_for_initial_message(); - app_debug_msg ("got a graphics-message from client... \\n"); - timer_handler(0); - } - } else - // here glut has been initialized previously - // probably the user pressed window-'close' - // - set_mode(MODE_HIDE_GRAPHICS); // close any previously open windows - } - // ok we should be ready & initialized by now to call glutMainLoop() - // - app_debug_msg ("now calling glutMainLoop()...\\n"); - glutMainLoop(); - app_debug_msg("...glutMainLoop() returned!! This should never happen...\\n"); + while( 1 ) + { + app_debug_msg ("Graphics-thread now waiting for client-message...\\n"); + wait_for_initial_message(); + timer_handler(0); + app_debug_msg ("Graphics-thread now running glutMainLoop()...\\n"); + glutMainLoop(); + app_debug_msg ("Graphics-thread glutMainLoop() returned...\\n"); + } + } #ifndef _DEBUG Cheers, mark somers. |
4) Message boards : Web interfaces : new boinc project w extra web features
Message 3038 Posted 12 Feb 2006 by m.somers |
Hello, I'm Mark Somers and I'm halfway in setting up a BOINC project at the University of Leiden. Currently things are running on a test server and it all seems to be working. The reason I'm mentioning this here is cause I extended the web interface of the BOINC package to allow for users to submit calculations / workunits. You are invited to have a look at: https://fwnc7003.leidenuniv.nl/Classical Please keep in mind I'm still developing and any ideas are welcome ;-). I based my BOINC server on the nightly snapshot of the 5.31 version on 10-06-2005. I had to debug some of the server/client software too a bit. I'll put in a thread for that too ;-). Cheers, mark. |
Copyright © 2024 University of California.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License,
Version 1.2 or any later version published by the Free Software Foundation.