Circular references, memory leaks, fieldhashes and Mojolicious

INTRODUCTION

Yesterday we could see very engrossing topic on Mojolicious issues tracker. It was already slightly edited by the author, but you still can get the point. Let's try to deal what is circular references, how they can produce memory leaks and should Mojolicious use fieldhashes inside Mojo::IOLoop::Delay.

read

My thought about DNS resolving inside Mojolicious

INTRODUCTION

As you all know Mojolicious uses non-blocking IO for network operations. This allows Mojo::Server::* to process many requests simultaneously, make many http requests with Mojo::UserAgent in parallel and other cool things.

But there is one hickey which may block whole non-blocking app with Mojolicious. It is known as host name resolution. For now Mojolicious uses blocking host name resolution provided by IO::Socket::* backend. This is gethostbyname(3) for IO::Socket::INET and getaddrinfo(3) for IO::Socket::IP. This is not the problem if you write web application which will just handle requests and will not produce any requests to internet itself. But if your application actively uses Mojo::UserAgent or Mojo::IOLoop::Client, for example, and your DNS server is not so fast, whole application may suffer and even misbehave. You may think that this is not the problem because your DNS server is fast enough: it resolves google.com to ip in 0.001 sec. But in fact your DNS server may return result for one domain in 0.001 sec and in 30 sec for other. No any warranty here. And all 30 sec your application will be blocked.

But why till now no one has written non-blocking DNS resolver for Mojolicious? In fact Mojolicious had non-blocking resolver since v0.999931 till v2.27. But as sri said this resolver sucked. This is why it was removed. And the only available alternative, as sri said, is to use getaddrinfo(3) from separate thread. This is how i started Net::DNS::Native few weeks ago.

read

Как поместить fusedav в /etc/fstab

Fusedav отличается от davfs2 отсутствием жесткого кеширования. Т.е. если в davfs2 выполнить команду cat somefile-1gb-file.txt на примонтированной ФС, то содержимое файла начнет попадать в консоль только после того как весь файл будет скачан в локальную ФС. При использовании драйвера fusedav содержимое файла начнет поступать в консоль сразу же по мере загрузки. Однако же это не делает возможным такие операции, как просмотр видео с webdav, т.к. судя по всему системные вызовы типа lseek здесь так же не способны обрабатываться должным образом и файл сначала целиком скачивается.

Добавляем Яндекс.Диск, как файловую систему в Linux

Здесь будет рассмотренно, как добавить Яндекс.Диск в linux систему с помощью davfs2 на примере Debian GNU/Linux, автоматическое монтирование при старте системы через /etc/fstab, и шифрование с использованием encfs.

Google Earth, Linux и шрифты

Установка Google Earth в debian производится нижеследующим способом

apt-get install googleearth-package
make-googleearth-package
dpkg -i googleearth_6.0.3.2197+0.7.0-1_amd64.deb

А вот возможный результат - полное отсутствие кирилических шрифтов

OSS emulation with ALSA

I faced out with this problem when tried to play Postal 2 on my debian PC. There was no sound and in the console I could see such error:

open /dev/[sound/]dsp: No such file or directory
read

PyQt and QImage.scanLine()

As we can see from the documentation QImage.scanLine() returns sip.voidptr object. But how to get pixels colors from this object? Reading sip documentation tells us that it has asstring(length) method, which returns length bytes from sip.voidptr position. Ok, that's enough to get colors pixel by pixel.

read
Later Earlier