Comments (6)
I've fallen behind on updating the readme on this repo since I'm preparing some formal docs that will be posted at icicle.io/docs. That example is out of date (plus you need to require the DNS package as well). Try requiring icicleio/dns
and run the examples found in that package.
from icicle.
I have tried http://icicleio.github.io/docs/getting-started/ this example but still got the error Class 'Icicle\Http\Server\Server' not found
from icicle.
That example requires the icicleio/http
package and is also out of date. Look at the examples found in that package. I'll try updating all the examples today or tomorrow. Clearly there needs to be some more basic examples on the getting started page that only rely on the base package.
from icicle.
Hello! I found strange bug in DNS package. The following code hangs up into endless loop and consumes 100% CPU:
#!/usr/bin/php
<?php
use Icicle\Coroutine;
use Icicle\Loop;
use Icicle\Http\Client\Client;
require __DIR__.'/vendor/autoload.php';
$generator = function() {
echo "Connecting to server\n";
$httpClient = new Client();
$socket = yield from \Icicle\Dns\connect('www.google.com', 80);
//$socket = yield from \Icicle\Dns\connect('77.37.250.212', 80);
echo "Socket OK\n";
echo $socket ? get_class($socket) : "NULL";
echo "\n";
};
$coroutine = Coroutine\create($generator);
echo "RUN LOOP\n";
Loop\run();
composer.json:
{
"minimum-stability": "dev",
"require": {
"icicleio/icicle": "~2.0",
"icicleio/http": "*",
"icicleio/dns": "*"
}
}
console output:
$ ./run.php
Connecting to server
RUN LOOP
But if I use commented line $socket = yield from \Icicle\Dns\connect('77.37.250.212', 80);
- all is OK:
$ ./run.php
Connecting to server
RUN LOOP
Socket OK
Icicle\Socket\NetworkSocket
Some additional info:
$ php -v
PHP 7.0.2-2+deb.sury.org~trusty+1 (cli) ( NTS )
Copyright (c) 1997-2015 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2015 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies
with Xdebug v2.4.0RC3, Copyright (c) 2002-2015, by Derick Rethans
$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=14.04
DISTRIB_CODENAME=trusty
DISTRIB_DESCRIPTION="Ubuntu 14.04.3 LTS"
Is it known problem?
from icicle.
@nexor This behavior was due to #17 that affects PHP 7.0.2. Your example code would hang in an infinite loop because the DNS lookup uses some code from the stream package that was affected by the bug. Using the IP address bypassed the affected code used by the DNS lookup. I've updated the stream package to avoid the bug, so run composer update
and try again, it should work as expected now.
@yobichi The documentation at icicle.io/docs has been updated with more examples to come. Please look there for examples and documentation. If you find any mistakes, please file an issue or PR on the repo at https://github.com/icicleio/docs.
from icicle.
Thanks! Now all works fine 👍
from icicle.
Related Issues (13)
- Ambiguous event extension description HOT 2
- Fix PHP requirement in the Readme HOT 10
- SocketEvent raise exception for fd resource HOT 6
- Memory leak in Loop HOT 1
- What is the best web framework for icicle to integrate in? HOT 4
- PHP 7.0.2 and 7.0.3 Generator Bug
- stream_select behaviour HOT 2
- Icicle performance test HOT 3
- Fatal error: Class 'Icicle\Http\Client not found. HOT 3
- defunct not exit HOT 2
- documentation in icicle.io domain is not available / parked
- PHP 5.4 using PHP 5.5 features HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from icicle.