Re: [Linuxsampler-devel] LSCP shell
On Friday 07 February 2014 08:54:53 Patrick Shirkey wrote: > It compiles fine for me on debian-7.0 64bit. However it crashes on start > and I get this backtrace: Does the attached patch fix it? CU Christian Index: src/shell/TerminalCtrl.cpp === --- src/shell/TerminalCtrl.cpp (revision 2516) +++ src/shell/TerminalCtrl.cpp (working copy) @@ -15,20 +15,26 @@ #include #include #include +#include "../common/Mutex.h" +using namespace LinuxSampler; + /// // class 'TerminalSetting' +static Mutex g_mutexReferences; static std::map g_terminalSettingReferences; static termios* _newTermios() { termios* p = new termios; +LockGuard lock(g_mutexReferences); g_terminalSettingReferences[p] = 1; return p; } static void _releaseTermiosRef(void* p) { if (!p) return; +LockGuard lock(g_mutexReferences); std::map::iterator it = g_terminalSettingReferences.find(p); assert(it != g_terminalSettingReferences.end()); assert(it->second > 0); @@ -41,6 +47,7 @@ static termios* _bumpTermiosRef(void* p) { if (!p) return NULL; +LockGuard lock(g_mutexReferences); std::map::iterator it = g_terminalSettingReferences.find(p); assert(it != g_terminalSettingReferences.end()); assert(it->second > 0); -- Managing the Performance of Cloud-Based Applications Take advantage of what the Cloud has to offer - Avoid Common Pitfalls. Read the Whitepaper. http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk___ Linuxsampler-devel mailing list Linuxsampler-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxsampler-devel
Re: [Linuxsampler-devel] LSCP shell
On Sat, February 8, 2014 1:01 am, Christian Schoenebeck wrote: > On Friday 07 February 2014 08:54:53 Patrick Shirkey wrote: >> It compiles fine for me on debian-7.0 64bit. However it crashes on start >> and I get this backtrace: > > Does the attached patch fix it? > Moves it slightly but looks to be the same error. I'm running lscp on a headless machine via ssh terminal in case that has any influence. Reading symbols from /usr/bin/lscp...done. (gdb) run Starting program: /usr/bin/lscp [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". Program received signal SIGSEGV, Segmentation fault. 0x7749449a in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (gdb) bt #0 0x7749449a in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6 #1 0x00408ade in operator-- (this=) at /usr/include/c++/4.7/bits/stl_tree.h:203 #2 std::_Rb_tree, std::_Select1st >, std::less, std::allocator > >::_M_insert_unique ( this=this@entry=0x60d420, __v=...) at /usr/include/c++/4.7/bits/stl_tree.h:1295 #3 0x00408c0b in std::_Rb_tree, std::_Select1st >, std::less, std::allocator > >::_M_insert_unique_ (this=this@entry=0x60d420, __position=..., __v=...) at /usr/include/c++/4.7/bits/stl_tree.h:1348 #4 0x0040812c in insert (__x=..., __position=..., this=0x60d420) at /usr/include/c++/4.7/bits/stl_map.h:576 #5 operator[] (__k=, this=0x60d420) at /usr/include/c++/4.7/bits/stl_map.h:458 #6 _newTermios () at TerminalCtrl.cpp:31 #7 TerminalCtrl::now () at TerminalCtrl.cpp:100 #8 0x0040a32f in KeyboardReader::KeyboardReader (this=0x60d100) at KeyboardReader.cpp:16 #9 0x00406caa in __static_initialization_and_destruction_0 (__initialize_p=, __priority=) at lscp.cpp:31 #10 _GLOBAL__sub_I_main () at lscp.cpp:249 #11 0x0040a4ad in __libc_csu_init () #12 0x769fbe40 in __libc_start_main () from /lib/x86_64-linux-gnu/libc.so.6 #13 0x00406e31 in _start () -- Patrick Shirkey Boost Hardware Ltd -- Managing the Performance of Cloud-Based Applications Take advantage of what the Cloud has to offer - Avoid Common Pitfalls. Read the Whitepaper. http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk ___ Linuxsampler-devel mailing list Linuxsampler-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxsampler-devel
Re: [Linuxsampler-devel] LSCP shell
On Friday 07 February 2014 17:25:27 Patrick Shirkey wrote: > On Sat, February 8, 2014 1:01 am, Christian Schoenebeck wrote: > > On Friday 07 February 2014 08:54:53 Patrick Shirkey wrote: > >> It compiles fine for me on debian-7.0 64bit. However it crashes on start > > > >> and I get this backtrace: > > Does the attached patch fix it? > > Moves it slightly but looks to be the same error. I'm running lscp on a > headless machine via ssh terminal in case that has any influence. No, that's irrelevant. It rather seems static variables of the application are initialized in a different order on your machine, but that order can be different on any system. Try the attached patch, it should fix it. CU Christian Index: src/shell/lscp.cpp === --- src/shell/lscp.cpp (revision 2516) +++ src/shell/lscp.cpp (working copy) @@ -27,8 +27,8 @@ using namespace std; using namespace LinuxSampler; -static LSCPClient g_client; -static KeyboardReader g_keyboardReader; +static LSCPClient* g_client = NULL; +static KeyboardReader* g_keyboardReader = NULL; static Condition g_todo; static String g_goodPortion; static String g_badPortion; @@ -66,7 +66,7 @@ // now add the suggested, correct characters s += g_suggestedPortion; g_suggestedPortion.clear(); -g_client.send(s); +g_client->send(s); } int main(int argc, char *argv[]) { @@ -103,12 +103,13 @@ // try to connect to the sampler's LSCP server and start a thread for // receiving incoming network data from the sampler's LSCP server -g_client.setCallback(onLSCPClientNewInputAvailable); -if (!g_client.connect(host, port)) return -1; -String sResponse = g_client.sendCommandSync( +g_client = new LSCPClient; +g_client->setCallback(onLSCPClientNewInputAvailable); +if (!g_client->connect(host, port)) return -1; +String sResponse = g_client->sendCommandSync( (autoCorrect) ? "SET SHELL AUTO_CORRECT 1" : "SET SHELL AUTO_CORRECT 0" ); -sResponse = g_client.sendCommandSync("SET SHELL INTERACT 1"); +sResponse = g_client->sendCommandSync("SET SHELL INTERACT 1"); if (sResponse.substr(0, 2) != "OK") { cerr << "Error: sampler too old, it does not support shell instructions\n"; return -1; @@ -117,8 +118,9 @@ // start a thread for reading from the local text input keyboard // (keyboard echo will be disabled as well to have a clean control on what // is appearing on the screen) -g_keyboardReader.setCallback(onNewKeyboardInputAvailable); -g_keyboardReader.startReading(); +g_keyboardReader = new KeyboardReader; +g_keyboardReader->setCallback(onNewKeyboardInputAvailable); +g_keyboardReader->startReading(); // main thread's loop while (true) { @@ -129,8 +131,8 @@ g_todo.Unlock(); // did network data arrive? -while (g_client.messageComplete()) { -String line = *g_client.popLine(); +while (g_client->messageComplete()) { +String line = *g_client->popLine(); //printf("line '%s'\n", line.c_str()); if (line.substr(0,4) == "SHU:") { int code = 0, n = 0; @@ -211,13 +213,13 @@ cout << line.substr(0,3) << flush; cfmt.reset(); cout << line.substr(3) << endl << flush; -} else if (g_client.multiLine()) { // multi-line response expected ... +} else if (g_client->multiLine()) { // multi-line response expected ... cout << endl << flush; while (true) { cout << line << endl << flush; if (line.substr(0, 1) == ".") break; - if (!g_client.lineAvailable()) break; - line = *g_client.popLine(); + if (!g_client->lineAvailable()) break; + line = *g_client->popLine(); } } else { cout << endl << line << endl << flush; @@ -225,8 +227,8 @@ } // did keyboard input arrive? -while (g_keyboardReader.charAvailable()) { -char c = g_keyboardReader.popChar(); +while (g_keyboardReader->charAvailable()) { +char c = g_keyboardReader->popChar(); CFmt cfmt; cfmt.white(); @@ -241,7 +243,7 @@ cout << c << flush; } -g_client.send(c); +g_client->send(c); } } -- Managing the Performance of Cloud-Based Applications Take advantage of what the Cloud has to offer - Avoid Common Pitfalls. Read the Whitepaper. http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk___ Linuxsampler-devel mailing list Linuxsampler-devel@lists.sourceforge.net https://l
Re: [Linuxsampler-devel] LSCP shell
On Friday 07 February 2014 00:25:35 raf wrote: > i don't know anything about bison... i wouldn't be of any help to track > down the problem. > > my version was 3.0.1, I updated to > [seijitsu@astrux linuxsampler-svn]$ bison -V > bison (GNU Bison) 3.0.2 > Written by Robert Corbett and Richard Stallman. > > but still got the same error. Yeah, I just tested it with Bison 3.0.2 and figured that those two C arrays are not automatically generated by Bison 3.x by default anymore. > looking more into the configure output I can see this message with some > warnings related to bison : > > Searching for a parser generator...OK (/usr/bin/bison -y) > Generating LSCP parser... > lscp.y: warning: 1801 shift/reduce conflicts [-Wconflicts-sr] > lscp.y: warning: 1045 reduce/reduce conflicts [-Wconflicts-rr] > lscp.y: warning: 1801 shift/reduce conflicts [-Wconflicts-sr] > lscp.y: warning: 1045 reduce/reduce conflicts [-Wconflicts-rr] > Done Not related to this problem. It just reminds us that there are a lot of ambiguities in our LSCP grammar definition. In practice does not cause any problem for us though. > then later on, not blocking : > checking for ARTS artsc - version >= 0.9.5... no > *** The artsc-config script installed by ARTS could not be found > *** If ARTS was installed in PREFIX, make sure PREFIX/bin is in > *** your path, or set the ARTS_CONFIG environment variable to the > *** full path to artsc-config. Not related to this problem. ARTS does not exist on modern systems anymore. > what bison version do you have ? I just tested with Bison 2.x in the last few days. > can a 64bits system make a difference ? No, 32 bit or 64 bit does not make a difference. I'll try to find out how to convince Bison 3 to generate the two missing C arrays. CU Christian -- Managing the Performance of Cloud-Based Applications Take advantage of what the Cloud has to offer - Avoid Common Pitfalls. Read the Whitepaper. http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk ___ Linuxsampler-devel mailing list Linuxsampler-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxsampler-devel
Re: [Linuxsampler-devel] LSCP shell
On Sat, February 8, 2014 3:07 am, Christian Schoenebeck wrote: > On Friday 07 February 2014 17:25:27 Patrick Shirkey wrote: >> On Sat, February 8, 2014 1:01 am, Christian Schoenebeck wrote: >> > On Friday 07 February 2014 08:54:53 Patrick Shirkey wrote: >> >> It compiles fine for me on debian-7.0 64bit. However it crashes on >> start >> > >> >> and I get this backtrace: >> > Does the attached patch fix it? >> >> Moves it slightly but looks to be the same error. I'm running lscp on a >> headless machine via ssh terminal in case that has any influence. > > No, that's irrelevant. > > It rather seems static variables of the application are initialized in a > different order on your machine, but that order can be different on any > system. Try the attached patch, it should fix it. > Yep, working now. Thanks. -- Patrick Shirkey Boost Hardware Ltd -- Managing the Performance of Cloud-Based Applications Take advantage of what the Cloud has to offer - Avoid Common Pitfalls. Read the Whitepaper. http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk ___ Linuxsampler-devel mailing list Linuxsampler-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxsampler-devel
Re: [Linuxsampler-devel] LSCP shell
On Friday 07 February 2014 17:19:07 Christian Schoenebeck wrote: > > my version was 3.0.1, I updated to > > [seijitsu@astrux linuxsampler-svn]$ bison -V > > bison (GNU Bison) 3.0.2 > > Written by Robert Corbett and Richard Stallman. > > > > but still got the same error. > > Yeah, I just tested it with Bison 3.0.2 and figured that those two C arrays > are not automatically generated by Bison 3.x by default anymore. [snip] > I'll try to find out how > to convince Bison 3 to generate the two missing C arrays. Fixed in latest SVN version. Should compile without errors now. CU Christian -- Managing the Performance of Cloud-Based Applications Take advantage of what the Cloud has to offer - Avoid Common Pitfalls. Read the Whitepaper. http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk ___ Linuxsampler-devel mailing list Linuxsampler-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxsampler-devel