-
Posts
1,347 -
Joined
-
Last visited
-
Days Won
39
gebeer's Achievements
-
module SnipWire - Snipcart integration for ProcessWire
gebeer replied to Gadgetto's topic in Modules/Plugins
Same for me here, PHP 8 is ok. Also Snipcart v3 only. Thanks for updating the module!- 229 replies
-
- 1
-
-
- shopping cart
- snipcart
-
(and 2 more)
Tagged with:
-
As it happens, I looked into this with the latest version just a couple of days ago on a PW 3.0.208 install with Repeater Matrix and nested Repeaters inside Matrix items. Unfortunately there seems to be no support for Repeater Matrix.
-
Unable to obtain lock for session with SessionHandlerDB and Tracy enebled
gebeer replied to gebeer's topic in Tracy Debugger
Yes, PHP8.1 that is. I updated to latest version. Still same problem. Use Native PHP Session is unchecked. Thanks for all the effort you put into Tracy! We might just resort to not using SessionHandlerDB. The site is in development and about 1 month away from launch. Pre launch we will update PW to latest dev and test again. Maybe that thelps. I am not sure because I don't see Tracy anywhere in the backtrace. I can only tell that the error doesn't appear when Tracy is disabled. The reported error: Fatal error: Exception: Unable to obtain lock for session (retry in 30s) (in xxx/wire/modules/Session/SessionHandlerDB/SessionHandlerDB.module line 96) #0 [internal function]: ProcessWire\SessionHandlerDB->read('dbee8f43c207f5c...') #1 xxx/wire/core/Session.php(327): session_start(Array) #2 xxx/wire/core/Wire.php(413): ProcessWire\Session->___init() #3 xxx/wire/core/WireHooks.php(952): ProcessWire\Wire->_callMethod('___init', Array) #4 xxx/wire/core/Wire.php(484): ProcessWire\WireHooks->runHooks(Object(ProcessWire\Session), 'init', Array) #5 xxx/wire/core/Session.php(205): ProcessWire\Wire->__call('init', Array) #6 xxx/wire/core/ProcessWire.php(581): ProcessWire\Session->__construct(Object(ProcessWire\ProcessWire)) #7 xxx/wire/core/ProcessWire.php(315): ProcessWire\ProcessWire->load(Object(ProcessWire\Config)) #8 xxx/index.php(52): ProcessWire\ProcessWire->__construct(Object(ProcessWire\Config)) #9 {main} in xxx/index.php on line 64 Warning: Cannot modify header information - headers already sent by (output started at xxx/index.php:64) in xxx/wire/core/WireHttp.php on line 1705 Warning: Cannot modify header information - headers already sent by (output started at xxx/index.php:64) in xxx/wire/core/WireHttp.php on line 1705 Arrgh… Error: Exception: Unable to obtain lock for session (retry in 30s) (in /wire/modules/Session/SessionHandlerDB/SessionHandlerDB.module line 96) #0 [internal function]: ProcessWire\SessionHandlerDB->read('dbee8f43c207f5c...') #1 /wire/core/Session.php(327): session_start(Array) #2 /wire/core/Wire.php(413): ProcessWire\Session->___init() #3 /wire/core/WireHooks.php(952): ProcessWire\Wire->_callMethod('___init', Array) #4 /wire/core/Wire.php(484): ProcessWire\WireHooks->runHooks(Object(ProcessWire\Session), 'init', Array) #5 /wire/core/Session.php(205): ProcessWire\Wire->__call('init', Array) #6 /wire/core/ProcessWire.php(581): ProcessWire\Session->__construct(Object(ProcessWire\ProcessWire)) #7 /wire/core/ProcessWire.php(315): ProcessWire\ProcessWire->load(Object(ProcessWire\Config)) #8 /index.php(52): ProcessWire\ProcessWire->__construct(Object(ProcessWire\Config)) #9 {main} This error message was shown because: site is in debug mode. ($config->debug = true; => /site/config.php). Error has been logged. Everytime that error happens, the site gets unresponsive for about a minute or so. After first reload I get another error reported by Tracy: User Error Exception: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away (in xxx/wire/core/PageFinder.php line 821) #0 xxx/wire/core/Wire.php(419): ProcessWire\PageFinder->___find(Object(ProcessWire\Selectors), Array) #1 xxx/wire/core/WireHooks.php(952): ProcessWire\Wire->_callMethod('___find', Array) #2 xxx/wire/core/Wire.php(484): ProcessWire\WireHooks->runHooks(Object(ProcessWire\PageFinder), 'find', Array) #3 xxx/wire/core/PagesLoader.php(424): ProcessWire\Wire->__call('find', Array) #4 xxx/wire/core/Pages.php(289): ProcessWire\PagesLoader->find('template=admin,...', Array) #5 xxx/wire/core/Wire.php(419): ProcessWire\Pages->___find('template=admin,...', Array) #6 xxx/wire/core/WireHooks.php(952): ProcessWire\Wire->_callMethod('___find', Array) #7 xxx/wire/core/Wire.php(484): ProcessWire\WireHooks->runHooks(Object(ProcessWire\Pages), 'find', Array) #8 xxx/wire/core/PagesLoader.php(1917): ProcessWire\Wire->__call('find', Array) #9 xxx/wire/core/Pages.php(244): ProcessWire\PagesLoader->count('template=admin,...', Array) #10 xxx/wire/core/PagesEditor.php(1877): ProcessWire\Pages->count('template=admin,...') #11 xxx/wire/core/Pages.php(1912): ProcessWire\PagesEditor->newPageOptions(Array) #12 xxx/site/modules/RockMigrations/MagicPages.module.php(45): ProcessWire\Pages->newPage(Array) #13 xxx/wire/core/WireHooks.php(1051): RockMigrations\MagicPages->RockMigrations\{closure}(Object(ProcessWire\HookEvent)) #14 xxx/wir … #20 {main} And in that lifecycle there's also this warning PHP Warning: session_write_close(): Failed to write session data using user defined save handler. (session.save_path: /usr/share/cgi-fpm/w01d84f4/tmp/) in Unknown The whole thing remains mysterious to me. Unfortunately I can't reproduce it on local ddev so I can't step debug it. On staging we don't have xdebug available. Anyways thanks to everyone for looking into this. As I said above, I'll test again when the site is ready to go live. Fortunately. the error occurs only when using the InputfieldSelector in SearchEngine's module settings. When using it with regular PageFinder, everything is ok. -
Unable to obtain lock for session with SessionHandlerDB and Tracy enebled
gebeer replied to gebeer's topic in Tracy Debugger
@netcarverunfortunately I'm now still getting that error with your module still enabled. Heres the session log: And always shortly after that there the DB goes away. I think those are related. -
Unable to obtain lock for session with SessionHandlerDB and Tracy enebled
gebeer replied to gebeer's topic in Tracy Debugger
I can confirm that with your module I do not get the error. -
Unable to obtain lock for session with SessionHandlerDB and Tracy enebled
gebeer replied to gebeer's topic in Tracy Debugger
I'll give it a shot and get back asap -
Unable to obtain lock for session with SessionHandlerDB and Tracy enebled
gebeer replied to gebeer's topic in Tracy Debugger
For me the error occurs every time I try to use the InputfieldSelector field for indexing pages in SearchEngine module after choosing "template": This is issuing an XHR Request to: https://ziehm.ddev.site/processwire/module/?InputfieldSelector=opval&field=template&type=&name=index_pages_now_selector -
Hi, in reference to https://processwire.com/talk/topic/26070-error-exception-unable-to-obtain-lock-for-session/ I need to bring this up again. Happens on PW 3.0.208, with TracyDebugger 4.23.33. Only when SessionHandlerDB is installed. The error Fatal error: Exception: Unable to obtain lock for session (retry in 30s) (in xxx/wire/modules/Session/SessionHandlerDB/SessionHandlerDB.module line 96) #0 [internal function]: ProcessWire\SessionHandlerDB->read('836ab08de536179...') #1 xxx/wire/core/Session.php(327): session_start(Array) #2 xxx/wire/core/Wire.php(413): ProcessWire\Session->___init() #3 xxx/wire/core/WireHooks.php(952): ProcessWire\Wire->_callMethod('___init', Array) #4 xxx/wire/core/Wire.php(484): ProcessWire\WireHooks->runHooks(Object(ProcessWire\Session), 'init', Array) #5 xxx/wire/core/Session.php(205): ProcessWire\Wire->__call('init', Array) #6 xxx/wire/core/ProcessWire.php(581): ProcessWire\Session->__construct(Object(ProcessWire\ProcessWire)) #7 xxx/wire/core/ProcessWire.php(315): ProcessWire\ProcessWire->load(Object(ProcessWire\Config)) #8 xxx/index.php(52): ProcessWire\ProcessWire->__construct(Object(ProcessWire\Config)) #9 {main} in xxx/index.php on line 64 No error when I disable Tracy. Sorry if this has been brought up before or even fixed already. I am not aware of that. This only happens on the staging server, not in the local ddev environment. Both PHP 8.1., MariaDB 10.5.19.
-
Error: Exception: Unable to obtain lock for session
gebeer replied to nbcommunication's topic in General Support
can confirm same behaviour. Disabling TracyDebugger helps. Fatal error: Exception: Unable to obtain lock for session (retry in 30s) (in xxx/wire/modules/Session/SessionHandlerDB/SessionHandlerDB.module line 96) #0 [internal function]: ProcessWire\SessionHandlerDB->read('836ab08de536179...') #1 xxx/wire/core/Session.php(327): session_start(Array) #2 xxx/wire/core/Wire.php(413): ProcessWire\Session->___init() #3 xxx/wire/core/WireHooks.php(952): ProcessWire\Wire->_callMethod('___init', Array) #4 xxx/wire/core/Wire.php(484): ProcessWire\WireHooks->runHooks(Object(ProcessWire\Session), 'init', Array) #5 xxx/wire/core/Session.php(205): ProcessWire\Wire->__call('init', Array) #6 xxx/wire/core/ProcessWire.php(581): ProcessWire\Session->__construct(Object(ProcessWire\ProcessWire)) #7 xxx/wire/core/ProcessWire.php(315): ProcessWire\ProcessWire->load(Object(ProcessWire\Config)) #8 xxx/index.php(52): ProcessWire\ProcessWire->__construct(Object(ProcessWire\Config)) #9 {main} in xxx/index.php on line 64 -
@flydev wow, that is really impressive. I am far below your knowledge level atm. Thanks very much for sharing those links. Will certainly help me to brush up my knowledge. That idea about the forum chatbot is great. But that would be quite a lot of info to ingest. for large data sets like these, would you use pinecone or weaviate or other solutions?
-
That prompt is pretty amazing. I gave it the task: It did a quite good job without me having to iterate manually over the results (not tested): <?php class ErrorInterceptor extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'Error Interceptor', 'version' => 1, 'summary' => 'Intercepts all warnings, errors, exceptions, and fatal errors, adds a backtrace, unifies the message, and logs it using the ProcessWire log API.', 'autoload' => true, 'singular' => true, ); } public function init() { set_error_handler(array($this, 'errorHandler')); set_exception_handler(array($this, 'exceptionHandler')); register_shutdown_function(array($this, 'shutdownFunction')); } public function errorHandler($errno, $errstr, $errfile, $errline) { $backtrace = debug_backtrace(); $unifiedMessage = $this->unifyMessage('Error', $errno, $errstr, $errfile, $errline, $backtrace); $this->logError($unifiedMessage); } public function exceptionHandler($exception) { $errno = $exception->getCode(); $errstr = $exception->getMessage(); $errfile = $exception->getFile(); $errline = $exception->getLine(); $backtrace = $exception->getTrace(); $unifiedMessage = $this->unifyMessage('Exception', $errno, $errstr, $errfile, $errline, $backtrace); $this->logError($unifiedMessage); } public function shutdownFunction() { $error = error_get_last(); if ($error !== null) { $errno = $error['type']; $errstr = $error['message']; $errfile = $error['file']; $errline = $error['line']; $backtrace = debug_backtrace(); $unifiedMessage = $this->unifyMessage('Fatal Error', $errno, $errstr, $errfile, $errline, $backtrace); $this->logError($unifiedMessage); } } private function unifyMessage($errorType, $errno, $errstr, $errfile, $errline, $backtrace) { $unifiedMessage = array( 'type' => $errorType, 'code' => $errno, 'message' => $errstr, 'file' => $errfile, 'line' => $errline, 'backtrace' => $backtrace ); return json_encode($unifiedMessage, JSON_PRETTY_PRINT); } private function logError($unifiedMessage) { $log = $this->wire('log'); $log->save('ErrorInterceptor', $unifiedMessage); } } Instead of using it on flowgpt.com, I put it in my locally hosted chatbot-ui. I installed it from https://github.com/jorge-menjivar/chatbot-ui which is a fork of the original https://github.com/mckaywrigley/chatbot-ui with some more features and bugfixes. I run it as a docker container locally. This ui is great because it lets you save and manage your prompts (and system prompts). It offers prompt variables, so I took that long prompt, added a variable where you are supposed to put in your project details and now I can use this prompt very conveniently. It also letz you export/import conversations, search the web etc. More info and some demos of the tool: twitter.com/chatbotui Interesting. Do you finetune existing models or use tools like langchain to create bots with custom context? I am experimenting with the latter and got some pretty good results so far. This is in the early stages but looks promising. I am building a vector db (chromadb) with embeddings for the complete core codebase of PW and then query that db to give context to a chatbot so it can answer coding questions on PW more specifically. ATM I only gave it the contents of the wire/core folder which is already 250MB in the vector db. The answers I'm getting out of it so far are quite good. The challenge here lies in optimizing the text splitter and creating the embeddings in a way targeting the LLM you are going to use for the chat. Ultimate goal is to have this running locally without proprietary LLMs like chatGPT. https://github.com/imartinez/privateGPT is a great project that can help with that. Open source models are getting better and better. So I hope in the not so distant future we can have our local coding assistants.
-
with this code you are setting the template of the page to 'myTemplate'. You need to use == or === as a comparison operator if(($page->template == "myTemplate") EDIT: don't worry, we've all been there 🙂
-
Have you been able to solve this? I had the very same issue some time ago. In my case it was related to the machine I was working on. It only happened on my notebook. On the desktop everything was fine. I never went to investigate this deeper because at that time I happened to do an OS reinstall (Linux) on my notebook. I suspect though that it might had something to do with the local time on my notebook OS not being correct or something along those lines. What I used as a temp workaround is to force login with my superuser account in _main.php or home.php (can't remember exactly) so I was able to work on the site locally. $session->forceLogin('superusername');
-
Hi all, I read through https://www.php.net/manual/en/language.namespaces.basics.php, https://www.php.net/manual/en/language.namespaces.rules.php and @MoritzLostvery nice writup here: Been using PW classloader and namespacing for quite a while. Now for the first time I run into problems. On the local and remote dev environments everything is working as expected. Now moving the site to staging for the first time, I get an E\error Trait not found (see below for exact error in context). Here's my setup all environments on PHP 8.1 with PW 3.0.208: site/modules/Site/Site.module.php public function __construct() { parent::__construct(); $this->wire->classLoader->addNamespace("Diff", __DIR__ . "/classes"); } site/modules/Site/classes/ResponsiveImages.php <?php namespace Diff; use ProcessWire\Pageimage; use ProcessWire\WireException; use function ProcessWire\wireInstanceOf; trait ResponsiveImages { /** * renders responsive picture tag for specific breakpoints/sizes * used for product description image, ... * @param PageImage $pageImage * @param bool $full optional, default false, if true, sizes attribute will be '100vw' * @return string picture markup */ public function renderImageFormat1($pageImage, $full = false) { ... site/classes/DefaultPage.php <?php namespace ProcessWire; use Diff\ResponsiveImages; #use RockMigrations\MagicPage; /** * Custom page class that provides properties/methods for all pages * * */ class DefaultPage extends Page { use ResponsiveImages; #use MagicPage; On the staging server this throws the error: Fatal Error: Trait "Diff\ResponsiveImages" not found if I change the first use statement to `use \Diff\ResponsiveImages;` the error is gone. In my understanding this doesn't make sense, because with the $wire->classloader the namespace 'Diff' is loaded inside the 'ProcessWire' namespace and not as a direct descendant of the root namespace '\'. Or am I wrong in my assumption? And if it is added to the root namespace as \Diff then it should throw errors in all environments? EDIT: I see from the ResponsiveImages.php that indeed my namspace Diff seems to live off root namespace. Otherwise my IDE wouldn't have added that namespace import statements for \ProcessWire\Pageimage etc I see in Moritz's example that he is defining his namespace explicitely under ProcessWire like 'ProcessWire\\TrelloWire' inside the classloader function. (I think the double backslash is not needed anymore, looking at https://github.com/processwire/processwire/blob/6ff498f503db118d5b6c190b35bd937b38b80a77/wire/core/WireClassLoader.php#L239 ff) What could be the reason for that server behaving in that way? Like I said, in other environments (and on other projects) that has never been an issue. And I see other modules setup in a similar fashion (like @bernhard's for example). That makes me think that there might be some server setting for that or some PHP module missing on that specific server?